Install & Generate An SSH Keys And Disable Password Authentication On Ubuntu

Posted By Weston Ganger

When using SSH to access your server it can get annoying to enter the password every time. Well not only that but password authentication poses a security risk as well because you may be vulnerable to brute force attacks.

Here we will setup SSH keys and disable password authentication.

First install ssh server on your server

# reload the ssh configuration
sudo service ssh reload

# disconnect from server
exit

# try connecting without the need of a password, you may need to give a password to access your private key file but not for the ssh program.
ssh user@domain.com

# try to connect to server with ssh key file auth disabled
ssh user@domain.com -o PubkeyAuthentication=no
# this should give you a permission denied message

There you go you should have it all setup with no more need of passwords.

One handy tip if you did not know is that you can copy your .ssh folder to all of your machines and they can share the ssh keys. You will just have to restart the ssh-agent after copying the files. But that way your can save them and not have to manage a million ssh keys.

Related External Links:

Article Topic:Software Development - Linux

Date:July 27, 2015