to login without supplying password, you generate key and copy public key to user's home direcotry under .ssh as authorized_keys
[ashok@new-host-4 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/ashok/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ashok/.ssh/id_dsa.
Your public key has been saved in /home/ashok/.ssh/id_dsa.pub.
The key fingerprint is:
f2:ae:fc:ac:75:e1:46:4b:8a:9e:f1:94:14:bf:59:d7 ashok@new-host-4.home
The key's randomart image is:
+--[ DSA 1024]----+
| |
| |
| . |
| o . |
| . S = . . E|
| = * * . |
| o * B |
| o O o |
| *+= |
+-----------------+
[ashok@new-host-4 .ssh]$ pwd
/home/ashok/.ssh
[ashok@new-host-4 .ssh]$ ls
id_dsa id_dsa.pub known_hosts
[ashok@new-host-4 .ssh]$ ls -l
total 12
-rw-------. 1 ashok ashok 668 Dec 30 19:38 id_dsa
-rw-r--r--. 1 ashok ashok 611 Dec 30 19:38 id_dsa.pub
-rw-r--r--. 1 ashok ashok 348 Dec 30 19:34 known_hosts
[ashok@new-host-4 .ssh]$ cp id_dsa.pub authorized_keys
[ashok@new-host-4 .ssh]$ ls -ltr
total 16
-rw-r--r--. 1 ashok ashok 348 Dec 30 19:34 known_hosts
-rw-------. 1 ashok ashok 668 Dec 30 19:38 id_dsa
-rw-r--r--. 1 ashok ashok 611 Dec 30 19:38 id_dsa.pub
-rw-r--r--. 1 ashok ashok 611 Dec 30 19:39 authorized_keys
[ashok@new-host-4 .ssh]$ ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is e8:7e:e8:d0:24:57:4f:18:64:bd:2c:84:a6:ac:6d:e4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
\S
Kernel \r on an \m
This is a system proected by US law
Last login: Wed Dec 30 19:31:32 2015 from 192.168.10.9
[ashok@new-host-4 ~]$ ^C
[ashok@new-host-4 ~]$ logout
Connection to localhost closed.
[ashok@new-host-4 .ssh]$ ssh 192.168.10.9
\S
Kernel \r on an \m
This is a system proected by US law
Last login: Wed Dec 30 19:39:42 2015 from localhost
[ashok@new-host-4 ~]$ logout
Connection to 192.168.10.9 closed.
[ashok@new-host-4 .ssh]$
No comments:
Post a Comment