diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/auth.inc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc index 5731c84..48d9c2e 100644 --- a/src/etc/inc/auth.inc +++ b/src/etc/inc/auth.inc @@ -548,9 +548,11 @@ function local_user_set(& $user) { pclose($fd); $userattrs = explode(":", trim($pwread)); + $skel_dir = '/etc/skel'; + /* determine add or mod */ if (($userattrs[0] != $user['name']) || (!strncmp($pwread, "pw:", 3))) { - $user_op = "useradd -m -k /etc/skel -o"; + $user_op = "useradd -m -k {$skel_dir} -o"; } else { $user_op = "usermod"; } @@ -579,6 +581,14 @@ function local_user_set(& $user) { @chown($user_home, $user_name); @chgrp($user_home, $user_group); + /* Make sure all users have last version of config files */ + foreach (glob("{$skel_dir}/dot.*") as $dot_file) { + $target = $user_home . '/' . substr(basename($dot_file), 3); + @copy($dot_file, $target); + @chown($target, $user_name); + @chgrp($target, $user_group); + } + /* write out ssh authorized key file */ if ($user['authorizedkeys']) { if (!is_dir("{$user_home}/.ssh")) { |