在设置连接远程ubuntuzh主机时发生错误

在设置连接远程主机时发生错误:ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

在远程ubuntu主机上查看:

bash 复制代码
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是上次建立连接时生成的文件,所以再次连接时报告已经建立过连接了。删

bash 复制代码
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,重新执行

bash 复制代码
Administrator@Administrator MINGW64 ~/.ssh
$ ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
/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 [email protected]
/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
[email protected]'s password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.


Administrator@Administrator MINGW64 ~/.ssh

连接建立成功。

相关推荐
lilye6644 分钟前
程序化广告行业(55/89):DMP与DSP对接及数据统计原理剖析
java·服务器·前端
SKYDROID云卓小助手2 小时前
三轴云台之相机技术篇
运维·服务器·网络·数码相机·音视频
东方佑2 小时前
自动调整PPT文本框内容:防止溢出并智能截断文本
linux·运维·powerpoint
泥土编程4 小时前
kubekey -实现懒人一键部署K8S集群
linux·运维
wirepuller_king7 小时前
创建Linux虚拟环境并远程连接,finalshell自定义壁纸
linux·运维·服务器
Yan-英杰7 小时前
【百日精通JAVA | SQL篇 | 第二篇】数据库操作
服务器·数据库·sql
在野靡生.7 小时前
Ansible(1)—— Ansible 概述
linux·运维·ansible
风123456789~7 小时前
【Linux运维】查询指定日期的上月
linux·运维·服务器
zyk_5208 小时前
Docker desktop如何汉化
运维·docker·容器
韭菜盖饭8 小时前
解决Docker端口映射后外网无法访问的问题
运维·docker·容器