SSH Tanpa Password di Red Hat / Centos – Assalamualaikum, untuk mengakses atau SSH ke server yang dimanage, setiap Sys Admin umumnya menggunakan password untuk otentikasi atau memasukan password ketika melakukan akses ke server.
Bagaiamana jika kita ingin melakukan SSH ke server kita tanpa menggunakan password?
Berikut caranya untuk melakukan SSH ke server tanpa menggunakan password.
- Jalankan ssh-keygen untuk membuat public-private key pair.
[student@desktopX ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/student/.ssh/id_rsa): Enter
Created directory '/home/student/.ssh'.
Enter passphrase (empty for no passphrase): Enter
Enter same passphrase again: Enter
Your identification has been saved in /home/student/.ssh/id_rsa.
Your public key has been saved in /home/student/.ssh/id_rsa.pub.
The key fingerprint is:
a4:49:cf:fb:ac:ab:c8:ce:45:33:f2:ad:69:7b:d2:5a [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . . |
| . * |
| . * S |
| + + . |
| o.E |
| o oo+oo |
| .=.**ooo |
+-----------------+
- Kirim ssh public key ke server tujuan menggunakan perintah ssh-copt-id
[student@desktopX ~]$ ssh-copy-id serverX
The authenticity of host 'serverX (172.25.X.11)' can't be established.
ECDSA key fingerprint is 33:fa:a1:3c:98:30:ff:f6:d4:99:00:4e:7f:84:3e:c3.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out
any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted
now it is to install the new keys
student@serverX's password: student
Number of key(s) added: 1
Now try logging into the machine, with:
"ssh 'student@serverX'"
and check to make sure that only the key(s) you wanted were added.
- Lakukan testing SSH ke server tujuan dan seharusnya server tidak akan meminta password lagi ketika kita mengaksesnya.
[student@desktopX ~]$ ssh serverX
Refrensi | Baca juga : Tes Koneksi Port Menggunakan Paping
Semoga bermanfaat & enjoy, wassalamualaikum