在设置连接远程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

连接建立成功。

相关推荐
张书名15 分钟前
高性能服务器配置经验指南3——安装服务器可能遇到的问题及解决方法
运维·服务器
bing_15840 分钟前
Nacos 客户端 SDK 的核心功能是什么?是如何与服务端通信的?
服务器·数据库·nacos 通信
supermapsupport1 小时前
SuperMap GIS基础产品FAQ集锦(20250421)
服务器·webgl·supermap·idesktop
前进的程序员1 小时前
在Linux驱动开发中使用DeepSeek的方法
linux·运维·服务器·人工智能
彭友圈1011 小时前
CE第二次作业
linux·服务器·网络
Tome--1 小时前
运维面试题01
运维
银河麒麟操作系统1 小时前
【银河麒麟高级服务器操作系统】磁盘只读问题分析
java·linux·运维·服务器·jvm
Jtti1 小时前
Ubuntu服务器上如何监控Oracle数据库
服务器·数据库·ubuntu
像风一样自由20202 小时前
FastMCP与FastAPI:构建自定义MCP服务器
服务器·microsoft·fastapi
生命有所坚持而生存可以随遇而安2 小时前
https nginx 负载均衡配置
服务器·nginx·负载均衡