summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/auth.inc13
1 files changed, 8 insertions, 5 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index 545c79e..9b82260 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -260,10 +260,13 @@ function local_user_set(& $user) {
/* write out ssh authorized key file */
if($user['authorizedkeys']) {
- if (!is_dir("{$user_home}/.ssh"))
- mkdir("{$user_home}/.ssh", 0700);
- $keys = base64_decode($user['authorizedkeys']);
- file_put_contents("{$user_home}/.ssh/authorized_keys", $keys);
+ if (!is_dir("{$user_home}/.ssh")) {
+ mkdir("{$user_home}/.ssh", 0700);
+ chown("{$user_home}/.ssh", $user_name);
+ }
+ $keys = base64_decode($user['authorizedkeys']);
+ file_put_contents("{$user_home}/.ssh/authorized_keys", $keys);
+ chown("{$user_home}/.ssh/authorized_keys", $user_name);
}
}
@@ -898,4 +901,4 @@ function session_auth($backing) {
return true;
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud