ssh免密码登陆
ssh免密码登陆
ssh-keygen -t rsa -f filename -C comment
ssh-copy-id -i ~/.ssh/filename.pub user@remote 把共钥附加到remote机器的.ssh/authorized_keys里面了; https://blog.csdn.net/wind520/article/details/38421359
注意远程机器的设置:https://blog.csdn.net/edc0228/article/details/54837297
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# 本机操作 ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/xxx.pub user@remote # 如果ssh的端口不是22,可用下面命令 ssh-copy-id -i ~/.ssh/id_rsa.pub "-p 23 user@remote" # 远程操作 chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
更改远端机器在本机的域名之后,ssh sname 的时候会出现提示,输入yes就可以了,会在
本机的.ssh/know_hosts文件中生成一行记录,会记录 sname ssh-rsa PK