summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Login/User.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-03 15:13:24 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-03 15:13:24 -0800
commita3dd4c078da9aefabef4a24d0af2e4382d9f74a1 (patch)
treea3403becf0032346f41d0b309f54a5767f57eb0b /lib/Vyatta/Login/User.pm
parentbb4083fa12386e9417e4dbae38325deb03d821e7 (diff)
downloadvyatta-cfg-system-a3dd4c078da9aefabef4a24d0af2e4382d9f74a1.tar.gz
vyatta-cfg-system-a3dd4c078da9aefabef4a24d0af2e4382d9f74a1.zip
Set modes of created authorization key (and directory)
sshd is picky about modes (and it should be), so make sure and chmod the file.
Diffstat (limited to 'lib/Vyatta/Login/User.pm')
-rwxr-xr-xlib/Vyatta/Login/User.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm
index f6706e4e..018e7e12 100755
--- a/lib/Vyatta/Login/User.pm
+++ b/lib/Vyatta/Login/User.pm
@@ -130,10 +130,11 @@ sub set_authorized_keys {
unless (-d $sshdir) {
mkdir $sshdir;
chown ($uid, $gid, $sshdir);
+ chmod (0750, $sshdir);
}
my $auth;
- unless (open (my $auth, "$sshdir/authorized_keys")) {
+ unless (open (my $auth, '>', "$sshdir/authorized_keys")) {
warn "open $sshdir/authorized_keys failed: $!";
return;
}
@@ -152,6 +153,7 @@ sub set_authorized_keys {
}
select STDOUT;
close $auth;
+ chmod (0640, "$sshdir/authorized_keys");
}
sub update {