summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-06-10 18:03:22 +0000
committerErmal Luçi <eri@pfsense.org>2009-06-10 18:03:22 +0000
commita22863604872856437dcb0ccc126f5cea4acef02 (patch)
tree5ba54d97a230f2dc2104dcd5a27b34eab8c92c32
parentbb1546f6f15dedd217a32a26648b1206e4356549 (diff)
downloadpfsense-a22863604872856437dcb0ccc126f5cea4acef02.zip
pfsense-a22863604872856437dcb0ccc126f5cea4acef02.tar.gz
Give proper rights to file when creating since php is run as root and might change permissions in dirs while modifying/creating them. Reported-by: http://forum.pfsense.org/index.php/topic,16890.0.html
-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