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

连接建立成功。

相关推荐
laimaxgg10 分钟前
Linux关于华为云开放端口号后连接失败问题解决
linux·运维·服务器·网络·tcp/ip·华为云
浪小满12 分钟前
linux下使用脚本实现对进程的内存占用自动化监测
linux·运维·自动化·内存占用情况监测
卷卷的小趴菜学编程1 小时前
c++之List容器的模拟实现
服务器·c语言·开发语言·数据结构·c++·算法·list
艾杰Hydra1 小时前
LInux配置PXE 服务器
linux·运维·服务器
多恩Stone1 小时前
【ubuntu 连接显示器无法显示】可以通过 ssh 连接 ubuntu 服务器正常使用,但服务器连接显示器没有输出
服务器·ubuntu·计算机外设
慵懒的猫mi1 小时前
deepin分享-Linux & Windows 双系统时间不一致解决方案
linux·运维·windows·mysql·deepin
Allen Bright1 小时前
使用 JMeter 的 Autostop Listener 插件:自动化性能测试的守护者
运维·jmeter·自动化
晚秋贰拾伍1 小时前
设计模式的艺术-代理模式
运维·安全·设计模式·系统安全·代理模式·运维开发·开闭原则
牙牙7051 小时前
ansible一键安装nginx二进制版本
服务器·nginx·ansible
hhzz1 小时前
ansible自动化运维实战--复制模块和用户模块(3)
运维·自动化·ansible