Avoiding repeating passwords in ssh_config file on CentOS 5

Environment :
Server A,, server1.localdomain, root, user1
Server B,, server2.localdomain, root, user2

Condition :
Server A, wanna put file of content in directory /app/web/ to Server B where owner is user1 and will execute by root

Server A
Login : user1

[user1@server1 ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Created directory '/home/user1/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user1/.ssh/id_rsa.
Your public key has been saved in /home/user1/.ssh/id_rsa.pub.
The key fingerprint is:
a4:71:58:3e:f7:7b:dc:d2:74:89:18:0f:7c:fb:cb:24 user1@server1.localdomain

List file in .ssh directory,

[user1@smtp .ssh]$ ls -la
total 32
drwx—— 2 user1 user1 4096 May 8 08:25 .
drwx—— 3 user1 user1 4096 May 8 08:25 ..
-rw——- 1 user1 user1 1675 May 8 08:25 id_rsa
-rw-r–r– 1 user1 user1 405 May 8 08:25 id_rsa.pub

Copy id_rsa.pub to Server B

# scp id_rsa.pub user2@

Server B
Login : user2

# mkdir .ssh
# cd .ssh
# cat /tmp/id_rsa.pub >> authorized_keys

# cat authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4dlTmpgbYavZFA08gNwaRHuXxDzIgXFgOHVbzZYZtFfJolVukuS8wX7QY0NKpLZvZJpYDglxVCfYWRqX2e4dDL8yl1fZbMqj1EQVzd253HOXOJmrG/NkFwKi/OTZfLTavk/93JKuaDkBuW3u4HDBYraikhWV+1smAVw617eKx7t4aKWgIeIRL3ZooWu2Egwml4qC1KtDFerUj9KNlamoPBeNQ1/YOe2G5es9GnhKDJ50HejyxRIveiF9mEZophHBU+4KmjnPfzaw6hiP7h3vDzXdDt229R4QS0Xi3SkEng27MxHYghrq81qPagfnXg2zVHH9GkwUC70aZYhnCkjjtw== user1@server1.localdomain

Leave a Reply

Your email address will not be published.