Luthfi Idris Cerita Linux, Jerman Wirausaha dan Hidup Sederhana

Login ssh tanpa password

Bosen juga kalau tiap kali mau rsync harus masukin password remote host. Ini karena saya sering rsync file untuk website ini. Kalau passwordnya mudah sih gak masalah, tapi kalau passwordnya sulit misalnya 15 strong bakalan jadi masalah terus. Ternyata agar login ssh tidak pakai password itu gampang banget. Hanya 3 langkah :

  1. Buat public dan private keys pakai ssh-keygen pada local host

     [email protected]$ ssh-keygen
     Generating public/private rsa key pair.
     Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
     Enter passphrase (empty for no passphrase): [Press enter key]
     Enter same passphrase again: [Pess enter key]
     Your identification has been saved in /home/jsmith/.ssh/id_rsa.
     Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
     The key fingerprint is:
     33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 [email protected]
    
  2. Copy public key ke remote host pakai ssh-copy-id

     [email protected]$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
    
  3. Coba login ke remote host tanpa password

     [email protected]$ ssh remote-host
     Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2
     [Note: SSH did not ask for password.]
     [email protected]$ [Note: You are on remote-host here]
    

« Pos Sebelumnya Pos Sesudahnya »