ssh免密码和ssh-copy-id命令

linux系统配置免密码的方式:

1:ssh-keygen -t rsa

生成密钥

2:ssh-copy-id -i ~/.ssh/id_rsa.pub jifeng@jifeng02

把本机的公钥追到jifeng02的 .ssh/authorized_keys 里

3:测试

[jifeng@jifeng04 .ssh]$ ssh jifeng02
Last login: Thu Aug  7 16:37:55 2014 from jifeng04
[jifeng@jifeng02 ~]$ 

4:如果ssh的端口不是22,可用下面命令

ssh-copy-id -i ~/.ssh/id_rsa.pub "-p 23 jifeng@jifeng03"

你可能感兴趣的:(Linux)