我使用Putty生成私钥和公钥 .
-
私钥保存在Windows C:\ ssh中
-
我还触摸了一个名为authorized_keys的新文件,该文件名为:/home/su/.ssh/
无论如何,我已经更改了文件sshd_config(===> sudo vim /etc/ssh/sshd_config )
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
AuthorizedKeysFile /home/su/.ssh/authorized_keys
当我完成设置putty并尝试登录它显示我服务器拒绝了我们的密钥
我打印出日志(==> tail -f /var/log/auth.log )没有关于授权密钥登录动作的日志~~~
有谁知道为什么?哪部分我忘了设置????
1 回答
首先,出于安全原因,请执行以下操作:
创建一个组或用户,您将使用visudo添加su - 权限
找到一条显示"root ALL=(ALL) ALL"的行,并在下面添加一行:"username ALL=(ALL) ALL" .
sshd_config中的3个和4个步骤:
PermitRootLogin no
HostbasedAuthentication no
对于密钥,我建议访问此站点:https://www.howtoforge.com/ssh_key_based_logins_putty
问候