Auto SSH to Host (To do Automated Rsync)

1

April 26, 2012 by aubreykloppers

To setup ssh to autoconnect from IP:201 to IP:200:

1. Copy the key from 201 to 200:
129.00.16.201$ mkdir ~/.ssh
129.00.16.201$ chmod 700 ~/.ssh
129.00.16.201$ ssh-keygen -q -f ~/.ssh/id_rsa -t rsa
Enter passphrase (empty for no passphrase): … (In our environment – Leave EMPTY)
Enter same passphrase again: …

# first, upload public key from client to server
129.00.16.201$ scp ~/.ssh/id_rsa.pub 129.47.16.200:

# next, setup the public key on server
129.00.16.200$ mkdir ~/.ssh (Not NEEDED on 200 – for future REF!)
129.00.16.200$ chmod 700 ~/.ssh (Not NEEDED on 200 – for future REF!)
129.00.16.200$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
129.00.16.200$ chmod 600 ~/.ssh/authorized_keys (Not NEEDED on 200 – for future REF!)
129.00.16.200$ rm ~/id_rsa.pub

 

 

2. On CLIENT (From where you connect) run the following commands:
129.00.16.201$ ssh-agent $SHELL
129.00.16.201$ ssh-add -l
The agent has no identities.
129.00.16.201$ ssh-add
Enter passphrase for /…/.ssh/id_rsa: …
Identity added: /…/.ssh/id_rsa (/…/.ssh/id_rsa)
129.00.16.201$ ssh-add -l
1024 00:65:6c:6c:6f:2c:20:77:6f:72:6c:64:21:20:3a:29 /…/.ssh/id_rsa (RSA)
129.00.16.201$ ssh 129.47.16.200

129.47.16.200$ exit

Advertisements

One thought on “Auto SSH to Host (To do Automated Rsync)

  1. domisse says:

    Really nice and clear !
    If you are familiar with certificate, i need to setup a proftpd server (sftp) passwordless. Any help welcome !

    Like

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

%d bloggers like this: