I used to always refer to a different site when I wanted to remember how to setup a machine to use SSH without a password. That site (I don’t recall what it is) isn’t around anymore. So, I guess I have to post the tutorial here.
SSH is one of the major tools in what I do. For any developers out there who don’t know about it, you’re missing out. Long gone are the days of requiring screen sharing or remote desktop to manage another computer. SSH is the bomb, and it’s been around for a long time.
Here’s how to use it, without needing to enter your password when you make a connection to a remote machine:
- On the computer you’re making a connection from (i.e. your home computer)
- If you do not have a ~/.ssh folder already, create one.
ssh-keygen -t dsa -f ~/.ssh/id_dsa -P ''
scp ~/.ssh/id_dsa.pub <username>@<servername>:~
- Make an old-skool connection to the server you just copied your public key to (i.e. your public webhost)
- on that server:
cat id_dsa.pub >> ~/.ssh/authorized_keys2
chmod 0600 ~/.ssh/authorized_keys2
That’s it. Keep in mind, that you’ll still need to specify your username when connecting to the host (if it’s different than your username on your local machine). If you want to get around that, you’ll need to setup an SSH config file (future tutorial?).Tags: linux security shell ssh tutorial