FreeBSD配置SSH允许root通过密钥登录

FreeBSD安装完,默认不允许root通过ssh登录,以下步骤可实现root用户通过密钥远程登录,同时禁用密码登录。
1.在主机终端编辑ssh配置文件,使root可以通过密码登录

# ee /etc/ssh/sshd_config
PermitRootLogin yes
PubkeyAuthentication yes
PermitEmptyPasswords no
PasswordAuthentication yes

2.重启SSH服务器

# /etc/rc.d/sshd restart

3.在自己的主机上执行命令,上传密钥

ssh-copy-id root@192.168.50.187

4.测试密钥登录成功后,关闭root密码登录功能

# ee /etc/ssh/sshd_config
PermitRootLogin yes
PubkeyAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication no

参考:

1.如何在FreeBSD服务器上配置SSH密钥的验证

2.freebsd ssh 用root登录

猜你喜欢

转载自www.cnblogs.com/xzqs/p/10051435.html