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

连接建立成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

aping_cs_dn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值