SSH without password

Bored of typing a password to access your remote desktop? Use a key!

Let’s say you are user1 and are using machineA.

You want to access machineB as user2.

Generate key pairs:

user1@machineA:~>ssh-keygen -t rsa

user1@machineA:~> ssh user2@machineB mkdir -p .ssh         
                  enter user2@machineB's password:
user1@machineA:~> cat .ssh/id_rsa.pub | ssh user2@machineB 'cat >> .ssh/authorized_keys'

If the ssh port is not the standard 22 and you use ip address rather than hostname

user1@machineA:~> cat .ssh/id_rsa.pub | ssh -p 0000 user2@ip.address 'cat >> .ssh/authorized_keys'
                  enter user2@machineB's password:            (one last time, I promise!)

user1@machineA:~> ssh user2@machineB hostname
                  or
                  ssh -p 0000 user2@ip.address

More info here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s