SSH automatically authentication between two boxes.

The followings are the steps to set up SSH automatically authentication:

 

3.1 Generate Public/private key pair in clients that need SSH/SCP access using public key under particular user id, such as root or josss,etc. to a remote server as shown in the following steps:

    

# su

 

The following commands need to run under the user account that will use public key authentication, such as root or josss, etc.

# cd $HOME/.ssh

# ssh-keygen -t rsa -f $HOME/.ssh/identity -N ""

 

Generating public/private rsa key pair.

Your identification has been saved in /root/.ssh/identity.

Your public key has been saved in /root/.ssh/identity.pub.

The key fingerprint is:

37:39:bd:e8:de:de:33:85:32:74:4f:33:42:01:bf:dc root@openssl-ssh

 

3.2 Upload public key into remote server’s the same user id’s, such as root’s or josss’s,  $HOME/.ssh directory . These commands need to run under the user account that will use public key authentication, such as root or josss,etc.

 

# scp –P 333 identity.pub (remote server name or IP address):/$HOME/.ssh/authorized_keys.01

For examples:

 

# scp –P 333 identity.pub 172.16.242.32:/$HOME/.ssh/authorized_keys.01

 

The authenticity of host '172.16.242.32 (172.16.242.32)' can't be established.

RSA key fingerprint is fd:be:a6:44:b8:7e:c1:4e:a5:11:3f:c9:d9:ac:eb:04.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '172.16.242.32' (RSA) to the list of known hosts.

root@172.16.242.32's password:

identity.pub                              100%  226     0.2KB/s   00:00

    

If root or josss user ID cannot be used for the above step, please use your own account.

 

Log into the remote server and run the following command under the user account that will use public authentication:

#cat  /root/.ssh/authorized_keys.01 >> $HOME/.ssh/authorized_keys

 

3.3 In the client, run the following command and make sure there is NO password being asked this time; If so, SSH automatically authentication set up successfully.

 

# scp –P 333 identity.pub (remote server name or IP address):/$HOME/.ssh/authorized_keys.test

For examples:

 

# scp –P 333 identity.pub 172.16.242.32:/$HOME/.ssh/authorized_keys.test

 

identity.pub                                  100%  226     0.2KB/s   00:00

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/223555/viewspace-503012/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/223555/viewspace-503012/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值