I'm trying to understand why I should use SSH keys instead of passwords.

I currently have an account with a different random 25 char password for each server. I use 'sudo' to elevate privileges when I need it.

If I set up SSH keys, I still need a password to use 'sudo'. So, why use SSH keys?

Is it solely to have the ability to disable password SSH logins and reduce the risk of brute force attacks?

  • This is not your answer but it is related. – mchid Jan 11 at 0:58
  • @mchid Thanks for the link. I see why ssh keys are better. That link explains it well. – Jose Martinez Jan 11 at 1:04
  • 1
    Passwords are vulnerable to brute force as you mentioned. As well as keylogging, peeping over the shoulder etc. With ssh keys even if someone gets hold of your password, they can't remotely access your computer. – user68186 Jan 11 at 1:19

SSH is a must use tool for system administrators. However, residing access security on a human entered password is not very wise.

Script kiddies may break into your system due to a lazy user with a weak password. And it is beyond the system administrator power to make users choose good passwords.

The good news is that there is a way to leave remote access open and have not to worry about passwords. The method consists on authentication via asymmetric cryptography. The user’s private key is the one that grants the authentication. You can even lock user’s account to disallow completely password authentication.

Another advantage of this method, is that one does not need different passwords to log on different servers. One can authenticate via the personal private key on all servers, needing not to remember several passwords.

It is also possible to make logins with no password asked with this method.


More Detailes

  • Thanks. I'm trying to envision this in an environment. I have my key pair. I put my (same) pub key on all the servers. Do I also just store a different password as well? Is that the advantage? – Jose Martinez Jan 11 at 1:05
  • yes, that's one of the advantages of it, using public key pairs offers considerably more protection than using passwords or password lists which can be captured if the client, the server or the secure session is compromised. In the case of not using a passphrase (which shouldn't happen), still public key pairs offer protection against compromised sessions and servers – Ahmed elesawy Jan 11 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.