运维开发网

linux设置ssh免密登录和ssh-copy-id命令

运维开发网 https://www.qedev.com 2020-07-17 15:42 出处:网络
本文链接:https://blog.csdn.net/hochoy/article/details/80749309linux系统配置免密码的方式:

本文链接:https://blog.csdn.net/hochoy/article/details/80749309

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

1:ssh-keygen -t rsa

ssh-keygen -t dsa

生成密钥

2:ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

# 接下来一路回车到底

cd /root

ssh-keygen -t rsa

# 接下来一路回车到底

ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]

ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]

ssh-copy-id -i ~/.ssh/id_dsa.pub [email protected]

其他机器也是,ssh-copy-id 在每台机器上均需执行

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

3:测试

[plain] view plain copy

[[email protected]]$ ssh tw-master

Last login: Thu Aug  7 16:37:55 2014 from tw-master

[[email protected]~]$   

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

ssh-copy-id -i ~/.ssh/id_rsa.pub "-p 23 [email protected]"

0

精彩评论

暂无评论...
验证码 换一张
取 消