Dedors’s Weblog

18. Juli 2008

Howto: Connect to SSH Server without entering Password or Passphrase

Gespeichert unter: Linux — dedors @ 15:03
Tags: , ,

Client-Side:

Here is assumed that client and server username is the same.

Generate a public/private key on the server machine in ~/.ssh/laptop & Generate a public/private key on the client machine in ~/.ssh/laptop

ssh-keygen -t dsa -f ~/.ssh/laptop
scp ~/.ssh/laptop.pub $USER@192.168.0.2:~

Create the folder ‘.ssh’ if it doesn’t exist and configure the public key to OpenSSH’s liking

ssh $USER@192.168.0.2
if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi ; mv laptop.pub .ssh/ ; cd .ssh/ ; if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi ; cat laptop.pub >> authorized_keys ; rm laptop.pub;
exit

Test if you can connect without being prompted for a password, but you should have to enter the passphrase

ssh -i ~/.ssh/laptop $USER@192.168.0.2

Add passphrase to ssh-agent:

ssh-add .ssh/latop

Manually Rsync via SSH

rsync -avrz   $USER@laptop:~/ .

Noch keine Kommentare »

Noch keine Kommentare.

RSS-Feed für Kommentare zu diesem Beitrag. TrackBack URI

Kommentieren

Bloggen Sie auf WordPress.com.