RedHat中敲sh-copy-id命令报错:-bash: ssh-copy-id: command not found

RedHat中敲sh-copy-id命令报错:-bash: ssh-copy-id: command not found

在多台Linux服务器SSH相互访问无需密码,

其中进入一台Linus中,对其进行拷贝一下到host中,出现

会不会是用户的权限问题,在root下执行:

[root@host6 hadoop]# ssh-copy-id
/usr/bin/ssh-copy-id: ERROR: No identities found

为啥出现这个样子? (目前我也没有解决,若您知道其原因望告知一下!)

查了半天,我得到一下几个方案:

1.执行下面,去掉最小化安装的问题.

   yum -y install openssh-clients

结果:

[root@host6 .ssh]# yum -y install openssh-clients
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
Nothing to do

[root@host6 .ssh]# exit
exit
[hadoop@host6 .ssh]$ sh-copy-id
bash: sh-copy-id: command not found

还是不行.

2 找到了另外一个方法,即:

1、如果ssh-copy-id 函数在远程服务器不存在;如下

[root@kt02 .ssh]# ssh-copy-id -i  id_rsa.pub hadoop@host

-bash: ssh-copy-id: command not found

     可以尝试用一下命令解决,直接复制本地的pubkey内容到远程服务器;

即到host2或者host6中执行以下

cat ~/.ssh/id_*.pub | ssh  hadoop@host2 'cat >> .ssh/authorized_keys'

既可以了。

转载于:多台Linux服务器SSH相互访问无需密码:http://kling.blog.51cto.com/3320545/1132800

原文地址:https://www.cnblogs.com/nucdy/p/5664257.html