密钥登陆报Permissions 0644

登陆方式:

  1. 修改配置文件/etc/ssh/sshd_config ,将"PasswordAuthentication yes"修改
    为"PasswordAuthentication no"
  2. 重启ssh服务
  3. 生成密钥
    在服务器端输入命令:
    [root@localhost~]# ssh-keygen -t rsa
  4. 将/root/.ssh/id_rsa.pub改名为/root/.ssh/authorized_keys :
    [root@localhost~]mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
  5. 将私钥id_rsa拷贝到客户机/root/.ssh/中
  6. 登陆报错
[root@localhost ~]# ssh 172.30.202.150

Authorized users only. All activities may be monitored and reported.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/root/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/root/.ssh/id_rsa": bad permissions
root@172.30.202.150: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

解决方法

直接chmod权限0600

posted @ 2022-12-27 09:37  逃亡的布丁  阅读(246)  评论(0编辑  收藏  举报