Home > Tech > Set up password-less ssh in 5 minutes

Set up password-less ssh in 5 minutes

I do this freaking a lot of times, and I sometimes forget about the process, so just to remind myself. It’s not only real easy, but also very secure. I highly recommend it. Technically it is called “SSH Key Exchange.” There might be a better person to talk about how it works, so I only explain how to set up. :P

Precondition

  • Server has configured to accept PubkeyAuthentication
    Most likely, what a server admin need to do is comment-in 3 lines at /etc/ssh/sshd_config, and reboot ssh.
  • You have generated a RSA key pair
    This is also very easy. Just type ssh-keygen -t rsa
  • Use Mac OS X or Unix based system.
    I know windows people can do it with Putty. When I need to do it, I will write this again. :P

Procedure

  1. login to where you want to connect to.
  2. make a directory on $HOME on the server you want to connect to
    mkdir .ssh
    chmod 700 .ssh
  3. copy public key from the client where you want to connect from. You can just open it with any text editor and get rid of line break.
    open $HOME/.ssh/id_rsa.pub
  4. make a file on the server you want to connect to.
    cd $HOME/.ssh
    vi authorized_keys
    ...
    chmod 755 authorized_keys
  5. try to connect
    ssh -i $HOME/.ssh/id_rsa -l USERNAME HOST_TO_CONNECT

That’s all! I often times, forgot to change permission… It matters!

Comments:1

Takashi Mizohata 09-01-14 (Wed) 18:07

I tried this again. I just copied from Terminal window, and I left and pasted it into “CONNECT TO” ’s authorized_keys. And it didn’t work. I saw error on /var/log/messages, sayng… “sshd[XXXX] error: key_read: uudecode XXXXX failed” So I got rid of from each line and it worked! No new line on public keys!

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://blog.nydd.org/2008/07/set-up-password-less-ssh-in-5-minutes/trackback/
Listed below are links to weblogs that reference
Set up password-less ssh in 5 minutes from Vantage Point of Queens

Home > Tech > Set up password-less ssh in 5 minutes

Search
Feeds
Meta
Links
Ads!

Return to page top