Fix group permission

This commit is contained in:
Jeremy Gardais 2022-03-30 10:39:10 +02:00
parent f2f4bf82aa
commit 4301c4c7eb
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 3 deletions

View File

@ -350,7 +350,7 @@ fix_directory_permissions() { # {{{
## Setting new permissions fail by default
return_fix_directory_permissions="1"
if chown --silent "${local_username}" -- "${local_directory}" 2> /dev/null; then
if chown --silent "${local_username}:${local_user_groupname}" -- "${local_directory}" 2> /dev/null; then
debug_message "fix_directory_permissions \
Successfully fix permissions for ${RED}${local_directory}${COLOR_DEBUG} (user: ${local_username})."
return_fix_directory_permissions="0"
@ -410,6 +410,8 @@ main() { # {{{
## Parse users list {{{
while IFS= read -r username; do
user_groupname=$(id --group -- "${username}" \
|| error_message "Can't get the primary group uid for ${username} user." 6)
### Create user's home directory {{{
### OR Exit
create_directory "${home_base}/${username}" \
@ -417,8 +419,8 @@ main() { # {{{
### }}}
### Fix permissions for this directory {{{
### OR Exit
fix_directory_permissions "${home_base}/${username}" "${username}" \
|| error_message "Can't fix permissions for ${username} home directory (path: ${home_base}/${username}, username: ${username}. Please use --debug option." 7
fix_directory_permissions "${home_base}/${username}" "${username}" "${user_groupname}" \
|| error_message "Can't fix permissions for ${username} home directory (path: ${home_base}/${username}, username: ${username}, group: ${user_groupname}. Please use --debug option." 7
### }}}
done < "${ldap_user_list_path}"