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

连接建立成功。

相关推荐
小小菜鸡ing1 小时前
pymysql
java·服务器·数据库
Mr. Cao code2 小时前
Docker:颠覆传统虚拟化的轻量级革命
linux·运维·ubuntu·docker·容器
wanhengidc3 小时前
云手机运行流畅,秒开不卡顿
运维·网络·科技·游戏·智能手机
笨小孩@GF 知行合一3 小时前
OSPF实验:外部路由引入
运维·网络·hcip·数通·ospf
asdfg12589634 小时前
为什么要在出口路由器router配置NAT与默认路由
运维·网络·计算机网络
当归10244 小时前
SQL Server死锁排查实战指南
java·服务器·网络
bug攻城狮4 小时前
Skopeo 工具介绍与 CentOS 7 安装指南
linux·运维·centos
宇宙第一小趴菜4 小时前
08 修改自己的Centos的软件源
linux·运维·centos
qinyia4 小时前
用 Wisdom SSH 轻松实现服务器自动化任务调度
服务器·自动化·ssh
bug攻城狮4 小时前
彻底禁用 CentOS 7.9 中 vi/vim 的滴滴声
linux·运维·服务器·centos·vim