diff --git a/useradmin/edit_user.cgi b/useradmin/edit_user.cgi index 4fa0b24cb..e00455fcc 100755 --- a/useradmin/edit_user.cgi +++ b/useradmin/edit_user.cgi @@ -221,11 +221,11 @@ print &ui_table_row(&hlink($text{'pass'}, "pass"), $text{'uedit_disabled'}, $disabled) : "") ); -# Show SSH public key field, for new users -if ($n eq '') { - print &ui_table_row(&hlink($text{'sshkey'}, "sshkey"), - &ui_textarea("sshkey", undef, 3, 60), 3); - } +# Show SSH public key field. Existing users only display the Webmin-managed +# key, identified by our marker in authorized_keys; unrelated keys stay hidden. +my $sshkey = $n ne '' ? &get_user_ssh_pubkey(\%uinfo) : undef; +print &ui_table_row(&hlink($text{'sshkey'}, "sshkey"), + &ui_textarea("sshkey", $sshkey, 4, 60), 3); print &ui_table_end(); diff --git a/useradmin/help/sshkey.html b/useradmin/help/sshkey.html index 5e026555e..f2004a947 100644 --- a/useradmin/help/sshkey.html +++ b/useradmin/help/sshkey.html @@ -1,7 +1,8 @@
SSH public key
-If supplied, the SSH key will be added to the new user's -authorized_keys file to allow an SSH login without a password using -the matching private key.

+If supplied, the SSH key will be added to the user's authorized_keys +file to allow an SSH login without a password using the matching private key. +For existing users, only the key managed by Webmin is shown and updated. Other +keys in authorized_keys are left unchanged.