一、用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