在设置连接远程ubuntuzh主机时发生错误
在设置连接远程主机时发生错误:ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
在远程ubuntu主机上查看:
aping@Administrator:~$ ls -l -a ./.ssh
total 20
drwx------ 2 aping aping 4096 Dec 6 10:32 .
drwxr-x--- 19 aping aping 4096 Dec 6 22:21 ..
-rw------- 1 aping aping 580 Dec 6 10:32 authorized_keys
-rw------- 1 aping aping 411 Dec 4 11:01 id_ed25519
-rw-r--r-- 1 aping aping 101 Dec 4 11:01 id_ed25519.pub
发现authorized_keys是上次建立连接时生成的文件,所以再次连接时报告已经建立过连接了。删
aping@Administrator:~$ ls -l -a ./.ssh
total 20
drwx------ 2 aping aping 4096 Dec 6 10:32 .
drwxr-x--- 19 aping aping 4096 Dec 6 22:21 ..
-rw------- 1 aping aping 580 Dec 6 10:32 authorized_keys
-rw------- 1 aping aping 411 Dec 4 11:01 id_ed25519
-rw-r--r-- 1 aping aping 101 Dec 4 11:01 id_ed25519.pub
aping@Administrator:~$ sudo rm -rf authorized_keys
[sudo] password for aping:
aping@Administrator:~$ ls -l -a ./.ssh
total 20
drwx------ 2 aping aping 4096 Dec 6 10:32 .
drwxr-x--- 19 aping aping 4096 Dec 6 22:21 ..
-rw------- 1 aping aping 580 Dec 6 10:32 authorized_keys
-rw------- 1 aping aping 411 Dec 4 11:01 id_ed25519
-rw-r--r-- 1 aping aping 101 Dec 4 11:01 id_ed25519.pub
aping@Administrator:~$
除该文件再次查看,还有但实际被清空了。
在windows的.ssh目录下右键打开git bash,重新执行
Administrator@Administrator MINGW64 ~/.ssh
$ ssh-copy-id -i ~/.ssh/id_rsa.pub aping@172.27.55.57
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/c/Users/Administrator/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: ERROR: ssh: connect to host 172.27.55.57 port 22: Connection timed out
Administrator@Administrator MINGW64 ~/.ssh
$ ssh-copy-id -i ~/.ssh/id_rsa.pub aping@172.27.55.57
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/c/Users/Administrator/.ssh/id_rsa.pub"
The authenticity of host '172.27.55.57 (172.27.55.57)' can't be established.
ED25519 key fingerprint is SHA256:SRIvdAW3zAaEtCjoiAHdJIrNTexf3VwGyqoTY5UXnwk.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
aping@172.27.55.57's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'aping@172.27.55.57'"
and check to make sure that only the key(s) you wanted were added.
Administrator@Administrator MINGW64 ~/.ssh
连接建立成功。
原文地址:https://blog.csdn.net/aping_cs_dn/article/details/144307055
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!