Linux中添加免密登录的步骤

1.关闭防?墙

systemctl status firewalld #查看状态
systemctl stop firewalld #停用防火墙
systemctl disable firewalld #关闭开机自启

2.修改sshd_config文件

PermitRootLogin yes

PubkeyAuthentication yes

RSAAuthentication yes

3.确认.ssh文件夹存在

不存在则在/root目录下创建.ssh文件夹

将.ssh文件夹赋予700权限

4.生成公钥私钥

  ssh-keygen -t rsa -P ""

4.1 追加登录许可列表

  cat id_rsa.pub >> authorized_keys
  • 若有多台服务器需要同时免密登录,则在authorized_keys中追加修改,保持所有服务器该文件内容相同即可(追加id_rsa.pub中内容)

Linux中添加免密登录的步骤

上一篇:单独编译dts【原创】


下一篇:Ubuntu 20.04 配置VNC远程桌面访问