SSH - Keys vs Passwords

SlowCoder

Gold Member
Gold Supporter
Joined
May 2, 2022
Messages
455
Reaction score
316
Credits
3,611
This is my effective sshd setup:
Code:
    Protocol 2
    Port 22

    # authentication
    PermitRootLogin no
    PasswordAuthentication no
    PermitEmptyPasswords no
    MaxAuthTries 3

I have key-based authentication set up on my SSH server, and PasswordAuthentication is set to no. It all works great. But when I need to add a new user key, I have to re-enable PasswordAuthentication so they can run ssh-copy-id. If I was doing this in a IT setting, this would be problematic.

Am I missing something?
 


Am I missing something?
Don't know, can't say.

However, for the remote computer, it has to have "PasswordAuthentication no" in it's configs to use a key, but since it's a new user, it won't have that by default, nor a key, and needs to use a password to authenticate to enable it to then be able to send the key. I could be wrong here, but that how it works for me.
 
You don't have to run ssh-copy-id.
You can manually copy the key to /home/user/.ssh/authorized_keys file.
(But then, how do you do that without a password?) You can use root
or another account that is already setup.
 


Top