Difference between revisions of "Ssh - automatic login"

From OnnoWiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 9: Line 9:
 
  chmod 700 ~/.ssh
 
  chmod 700 ~/.ssh
 
  ssh-keygen -t dsa
 
  ssh-keygen -t dsa
 +
ssh-keygen -t rsa
  
 
* copykan ke remote server
 
* copykan ke remote server
  
 
  scp ~/.ssh/id_dsa.pub remoteuser@remoteserver.com:
 
  scp ~/.ssh/id_dsa.pub remoteuser@remoteserver.com:
 +
scp ~/.ssh/id_rsa.pub remoteuser@remoteserver.com:
  
 
* di remote server append content public key id_dsa.pub ke ~/.ssh/authorized_keys dan delete file id_dsa.pub
 
* di remote server append content public key id_dsa.pub ke ~/.ssh/authorized_keys dan delete file id_dsa.pub
  
 +
mkdir .ssh
 +
touch .ssh/authorized_keys
 
  cat id_dsa.pub >> .ssh/authorized_keys
 
  cat id_dsa.pub >> .ssh/authorized_keys
 +
cat id_rsa.pub >> .ssh/authorized_keys
  
 
Atau sekaligus lakukan dengan cara
 
Atau sekaligus lakukan dengan cara
  
  cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys
+
ssh -l remoteuser remoteserver.com 'mkdir .ssh'
 +
ssh -l remoteuser remoteserver.com 'touch ~/.ssh/authorized_keys'
 +
  cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys'
  
 
jangan lupa delete id_dsa.pub dari home directory di remote server
 
jangan lupa delete id_dsa.pub dari home directory di remote server
Line 28: Line 35:
 
  ssh -l remoteuser remoteserver.com
 
  ssh -l remoteuser remoteserver.com
 
  ssh remoteuser@remoteserver.com
 
  ssh remoteuser@remoteserver.com
 +
 +
 +
==Alternatif Lain==
 +
 +
The whole process is much easier if you just use:
 +
 +
ssh-copy-id [-i [identity_file]] [user@]machine
 +
 +
ssh-keygen -t dsa
 +
ssh-keygen -t rsa
 +
ssh-copy-id user@machine
  
  
Line 37: Line 55:
  
 
* [[ssh]]
 
* [[ssh]]
 +
* [[ssh - menjalankan perintah secara remote]]
 +
* [[Persiapan SSH untuk SCP Batch]]

Latest revision as of 20:20, 28 September 2022

Sumber: http://wp.uberdose.com/2006/10/16/ssh-automatic-login/

  • public ssh key, cek pastikan ada file id_dsa.pub
~/.ssh
  • kalau belum ada id_dsa.pub di ~/.ssh lakukan
chmod 700 ~/.ssh
ssh-keygen -t dsa
ssh-keygen -t rsa
  • copykan ke remote server
scp ~/.ssh/id_dsa.pub remoteuser@remoteserver.com:
scp ~/.ssh/id_rsa.pub remoteuser@remoteserver.com:
  • di remote server append content public key id_dsa.pub ke ~/.ssh/authorized_keys dan delete file id_dsa.pub
mkdir .ssh
touch .ssh/authorized_keys
cat id_dsa.pub >> .ssh/authorized_keys
cat id_rsa.pub >> .ssh/authorized_keys

Atau sekaligus lakukan dengan cara

ssh -l remoteuser remoteserver.com 'mkdir .ssh'
ssh -l remoteuser remoteserver.com 'touch ~/.ssh/authorized_keys'
cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys'

jangan lupa delete id_dsa.pub dari home directory di remote server

selanjutnya kita dapat login tanpa di tanyakan password

ssh -l remoteuser remoteserver.com
ssh remoteuser@remoteserver.com


Alternatif Lain

The whole process is much easier if you just use:

ssh-copy-id [-i [identity_file]] [user@]machine
ssh-keygen -t dsa
ssh-keygen -t rsa
ssh-copy-id user@machine


Referensi

Pranala Menarik