Wednesday, January 19, 2011

SSH without passwords

If you need quick access from your home to the VPS there is an easy solution that won't require a password to login. First, create a private and public ssh key pair on your desktop:
ssh-keygen -t rsa
Copy the public key to the vps (replace vps by the hostname or IP address):
ssh-copy-id -i .ssh/id_rsa.pub vps

Login to the VPS from the desktop:
ssh vps

And you should be able to login without a password. Enjoy!

2 comments:

  1. If you want to use just a name insted of a long hostname or IP, you can add this to your ~/.ssh/config file:
    Host *What name you want*
    User *What user you want to log in as*
    Port *If you have custom port you can add that as well*
    HostName *hostname or IP*
    IdentityFile *if you have multiple private-keys you can add what one you would like to use*

    Just my five cents.

    ReplyDelete
  2. Good tip from CissaMalmin! As an alternative enter a simple hostname in /etc/hosts

    ReplyDelete