Posted by: sutrisno | December 29, 2010

SSH tanpa password

Dalam hal pekerjaan seorang Admin kita kadang meremote adalah pekerjaaan yang sering kita lakukan,Kalau kita mau ssh ke PC orang/ server lain kita tidak perlu memasukan password.cara nya sebagai berikut.

Dalam PC kita buat keynya dahulu dengan perintah
sutrisno@fian-H55M-S2:~/.ssh$ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ”
Generating public/private dsa key pair.
Your identification has been saved in /home/sutrisno/.ssh/id_dsa.
Your public key has been saved in /home/sutrisno/.ssh/id_dsa.pub.
The key fingerprint is:
09:56:68:75:14:31:cd:46:79:6e:2b:8d:81:28:65:11 sutrisno@fian-H55M-S2
The key’s randomart image is:
+–[ DSA 1024]—-+
| oE+**.. |
| o.o. .= . |
| .oo . o o |
| …… . o |
| .S = . |
| o o |
| . |
| |
| |
+—————–+
sutrisno@fian-H55M-S2:~/.ssh$ ls -la
total 28
drwx—— 2 sutrisno sutrisno 4096 2010-12-29 08:57 .
drwxr-xr-x 46 sutrisno sutrisno 4096 2010-12-29 08:10 ..
-rw-r–r– 1 sutrisno sutrisno 613 2010-12-17 11:32 authorized_keys
-rw——- 1 sutrisno sutrisno 668 2010-12-29 08:57 id_dsa
-rw-r–r– 1 sutrisno sutrisno 611 2010-12-29 08:57 id_dsa.pub
-rw-r–r– 1 sutrisno sutrisno 4862 2010-12-22 11:50 known_hosts

file id_dsa.pub ke tempat server yang mau di remote
sutrisno@fian-H55M-S2:~/.ssh$ scp id_dsa.pub chemonk@192.168.1.251:/home/chemonk/trisno
chemonk@192.168.1.251’s password:
id_dsa.pub 100% 611 0.6KB/s 00:00

kemudian ssh ke komputer chemonk
sutrisno@fian-H55M-S2:~/Documents/sql_tutorial$ ssh chemonk@192.168.1.251
chemonk@192.168.1.251’s password:
Linux chemonk-desktop 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux
Ubuntu 10.04 LTS

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/

437 packages can be updated.
157 updates are security updates.

Last login: Fri Dec 24 01:07:55 2010 from 125.162.33.208
chemonk@chemonk-desktop:~$ pwd
/home/chemonk
chemonk@chemonk-desktop:~$ls -lash .ssh/
total 28K
4.0K drwx—— 2 chemonk chemonk 4.0K 2010-12-20 22:08 .
20K drwxr-xr-x 94 chemonk chemonk 20K 2010-12-28 13:44 ..
4.0K -rw-r–r– 1 chemonk chemonk 1.3K 2010-12-28 13:42 known_hosts
chemonk@chemonk-desktop:~$ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ”
Generating public/private dsa key pair.
Your identification has been saved in /home/chemonk/.ssh/id_dsa.
Your public key has been saved in /home/chemonk/.ssh/id_dsa.pub.
The key fingerprint is:
1e:6b:51:48:95:17:52:51:84:89:f1:a2:94:07:7d:74 chemonk@chemonk-desktop
The key’s randomart image is:
+–[ DSA 1024]—-+
| oo+*=BE |
| . ++o=. |
| + +o. |
| . + . |
| S |
| . + |
| + |
| . |
| |
+—————–+
chemonk@chemonk-desktop:~$
chemonk@chemonk-desktop:~$ cat trisno/id_dsa.pub >> $HOME/.ssh/authorized_keys
chemonk@chemonk-desktop:~$ chmod 0600 $HOME/.ssh/authorized_keys

setelah itu kita coba ssh ke PC chemonk
sutrisno@fian-H55M-S2:~/Documents/sql_tutorial$ ssh chemonk@192.168.1.251
Linux chemonk-desktop 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux
Ubuntu 10.04 LTS

Welcome to Ubuntu!
* Documentation: https://help.ubuntu.com/

437 packages can be updated.
157 updates are security updates.

Last login: Wed Dec 29 08:56:56 2010 from fian-h55m-s2.local
chemonk@chemonk-desktop:~$

Kita bisa login tampah password.

silahkan mencoba..


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

Categories

%d bloggers like this: