Skip to content

Linux免密访问配置

在本机执行

shell
设置免密访问. 不设置密码 直接回车
ssh-keygen -t rsa
将公钥复制道远程服务器
scp -r ~/.ssh/id_rsa.pub root@39.100.130.232:~/.ssh/

在目标服务器执行

shell
#将公钥追加入授权文件【authorized_keys】
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
#.ssh目录权限设置为700
chmod 700 ~/.ssh
# 授权文件权限设置为600
chmod 600 ~/.ssh/authorized_keys

Released under the MIT License.