Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Wednesday, February 3, 2010

how to ssh without password

Let say you want to access to a machine with IP 192.168.1.10, and make sure you have
command ssh, ssh-keygen, ssh-copy-id.
First, generate the ‘key’, the key will be used to open the remote machine’s door.
ssh-keygen

You will see something like that
Enter file in which to save the key (/home/myname/.ssh/id_rsa):

Whatever it appears just press enter until it ends, press enter for passphase as well.
Okay, the ‘key’ will be generated, something looks like ~/.ssh/id_rsa.pub
Copy over the ‘key’ to remote machine, and enter your password
ssh-copy-id -i ~/.ssh/id_rsa.pub macspc@192.168.1.10

Done. Now you can ssh 192.168.1.10 with username macspc without password.
ssh macspc@192.168.1.10

What I Did

~? ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/brijith/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/brijith/.ssh/id_rsa.
Your public key has been saved in /home/brijith/.ssh/id_rsa.pub.
The key fingerprint is:
4b:71:39:69:36:13:0a:69:65:21:de:5f:24:b4:1c:b6 brijith@Newmegadisk
~? ssh-copy-id -i ~/.ssh/id_rsa.pub macpc@192.168.1.10
29
Password:
Now try logging into the machine, with "ssh 'macspc@192.168.1.10'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.


Now you can login through ssh with out a password

ssh macspc@192.168.1.10


It wont ask password any more.

If you want to launch application of the remote system in your PC using ssh use -X option of it

eg:

ssh -X macspc@192.168.1.10

and then give the application name you want to launch in resulting terminal
eg:
gedit&

This will launch gedit of remote system in your system

gedit