[root@node01 .ssh]# ssh-copy-id node01 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.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 node01 port 22: Connection refused
时间: 2023-09-08 07:11:11 浏览: 269
这是一个 SSH 连接失败的错误信息,可能是因为 node01 主机的 SSH 服务没有开启或者端口号不是 22。你需要先检查 node01 主机的 SSH 服务是否开启,以及 SSH 端口号是否正确。如果 SSH 服务没有开启,你需要先启动 SSH 服务。如果端口号不是 22,你需要在 ssh-copy-id 命令中指定正确的端口号。
相关问题
Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information. Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information. Invalid number of arguments. sed: -e expression #2, char 0: no previous regular expression spawn ssh-copy-id -i /root/.ssh/id_rsa /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.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: Could not resolve hostname /root/.ssh/id_rsa: Name or service not known Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Package chrony-3.2-2.el7.x86_64 already installed and latest version Nothing to do
这是一些命令行的输出,其中包括了 `grep`、`sed` 和 `ssh-copy-id` 等命令。`grep` 是用来搜索文本的命令,`sed` 是用来编辑文本的命令,`ssh-copy-id` 是用来将 SSH 公钥复制到远程主机上的命令。其中出现了一些错误,比如 `Invalid number of arguments`、`Could not resolve hostname` 等,需要进一步排查和处理。最后还有一些提示,比如 `Package chrony-3.2-2.el7.x86_64 already installed and latest version`,表示已经安装了 chrony 包且为最新版本。
ssh-copy-id master /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.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 master port 22: Connection refused
这个错误提示表明无法连接到主机master的22端口,可能是以下一些原因导致:
1. 确保您的主机名、IP地址、端口号和用户名都是正确的,可以使用ping命令测试主机是否可达。
2. 确保远程主机上的ssh服务已经启动并且正在监听22端口。可以使用命令 systemctl status sshd.service 来检查ssh服务状态。
3. 检查网络设置是否正确,比如是否有防火墙或路由器阻止了连接。
如果您已经排除了上述问题,但仍然无法连接到远程主机,请尝试在主机上手动安装ssh-copy-id,或者使用scp命令复制公钥到远程主机的authorized_keys文件中。
阅读全文