diff --git a/duplicati/create.homedir.sh b/duplicati/create.homedir.sh index 13a88a7..5662312 100755 --- a/duplicati/create.homedir.sh +++ b/duplicati/create.homedir.sh @@ -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}"