码迷,mamicode.com
首页 > 其他好文 > 详细

ssh -i 密钥文件无法登陆问题

时间:2020-01-30 21:13:26      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:lis   denied   files   ssi   mission   ast   tin   print   hosts   

一、用ssh 带密钥文件登录时候,发生以下报错
 [root@99cloud1 ~]# ssh -i hz-keypair-demo.pem centos@172.16.17.104
The authenticity of host ‘172.16.17.104 (172.16.17.104)‘ can‘t be established.
ECDSA key fingerprint is SHA256:HXYEa2IVBhTJ1AO+GDvROEvHM5ZRLgKxXsSaFmc6CNc.
ECDSA key fingerprint is MD5:cd:dd:3f:dd:66:91:30:4c:0e:e5:a2:35:45:c2:23:41.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.17.104‘ (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for ‘hz-keypair-demo.pem‘ are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "hz-keypair-demo.pem": bad permissions
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
二、修改密钥文件权限

[root@99cloud1 ~]# chmod 600 hz-keypair-demo.pem
[root@99cloud1 ~]# ip netns exec qdhcp-c2bc63d3-6ab2-4862-96f0-1a6d91df92f8 ssh -i hz-keypair-demo.pem centos@172.16.17.104

三、正常登录

[root@99cloud1 ~]# ssh -i hz-keypair-demo.pem centos@172.16.17.104
[centos@centos0130 ~]$ ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc pfifo_fast state UP group default qlen 1000
    link/ether fa:16:3e:fe:22:71 brd ff:ff:ff:ff:ff:ff
    inet 172.16.17.104/24 brd 172.16.17.255 scope global dynamic eth0
       valid_lft 85543sec preferred_lft 85543sec
    inet6 fe80::f816:3eff:fefe:2271/64 scope link
       valid_lft forever preferred_lft forever

ssh -i 密钥文件无法登陆问题

标签:lis   denied   files   ssi   mission   ast   tin   print   hosts   

原文地址:https://www.cnblogs.com/cloud-datacenter/p/12243556.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!