diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Vyatta/Login/User.pm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/Vyatta/Login/User.pm b/lib/Vyatta/Login/User.pm index 018e7e12..87dd4db4 100755 --- a/lib/Vyatta/Login/User.pm +++ b/lib/Vyatta/Login/User.pm @@ -115,7 +115,7 @@ sub _vyatta_users { sub set_authorized_keys { my $user = shift; my $config = new Vyatta::Config; - $config->setLevel("system login user $user authorized-keys"); + $config->setLevel("system login user $user authentication public-keys"); my @keys = $config->listNodes(); return unless @keys; @@ -139,19 +139,14 @@ sub set_authorized_keys { return; } - select $auth; - print "# Automatically generated by Vyatta configuration\n"; - print "# Do not edit, all changes will be lost\n"; - foreach my $key (@keys) { - my $type = $config->returnValue("$key key-type"); - print "$type $key"; - - my $comment = $config->returnValue("$key description"); - print " $comment" if $comment; - - print "\n"; + print {$auth} "# Automatically generated by Vyatta configuration\n"; + print {$auth} "# Do not edit, all changes will be lost\n"; + foreach my $name (@keys) { + my $type = $config->returnValue("$name type"); + my $key = $config->returnValue("$name key"); + print {$auth} "$type $key $name\n"; } - select STDOUT; + close $auth; chmod (0640, "$sshdir/authorized_keys"); } |