scp - 使用 scp 命令时出错 "bash: scp: command not found"

标签 scp openssh rhel

我想使用 scp 命令将本地文件复制到远程服务器,但在输入远程服务器中的用户密码后收到错误消息。

~]$ scp gitadmin.pub git@123.150.207.18:
git@123.150.207.18's password: 
bash: scp: command not found
lost connection

我使用 git 用户检查了服务器,似乎可以找到 scp 命令并且也安装了 openssh-clinets。

git@... ~]$ scp
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 ... [[user@]host2:]file2
git@... ~]$ su root
......
root@... ~]# yum info openssh-clients
Loaded plugins: product-id, subscription-manager
Updating Red Hat repositories.
Installed Packages
Name        : openssh-clients
Arch        : x86_64
Version     : 5.3p1
Release     : 52.el6
Size        : 1.0 M
Repo        : installed
From repo   : anaconda-RedHatEnterpriseLinux-201105101844.x86_64
Summary     : An open source SSH client applications
URL         : http://www.openssh.com/portable.html
License     : BSD
Description : OpenSSH is a free version of SSH (Secure SHell), a program for
            : logging into and executing commands on a remote machine. This
            : package includes the clients necessary to make encrypted
            : connections to SSH servers.

我对这种情况感到困惑。我是否缺少服务器上的某些配置? (我们使用 RHEL6 作为服务器。)

<小时/>

这是我的路径设置错误。 我在/etc/profile.d 中添加了“custom.sh”,并在其中添加了以下几行,以将/usr/local/node/bin 目录添加到 PATH。

export PATH="/usr/local/node/bin:$PATH" 

但是格式错误。我删除了这对 '"' 现在可以正常工作了。它应该是:

export PATH=$PATH:/usr/local/node/bin

探测错误...^_^

最佳答案

确保 scp 命令在双方上可用 - 在客户端和服务器上。

如果这是 FedoraRed Hat Enterprise Linux 及其克隆 (CentOS),请确保安装此软件包:

    yum -y install openssh-clients

如果您使用 DebianUbuntu 及其克隆版本,请安装此软件包:

    apt-get install openssh-client

同样,您需要在服务器和客户端上执行此操作,否则您可能会在客户端上遇到“奇怪”的错误消息:scp:找不到命令或类似的信息,尽管您在本地有它。我想这已经让成千上万的人感到困惑了:)

关于scp - 使用 scp 命令时出错 "bash: scp: command not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17131048/

相关文章:

linux - 在 Windows 中使用 Golang 中的 SCP 复制远程 unix 主机中的远程文件

windows - 使用 git 和 tortoisegit 在 Windows XP 上验证失败

linux - 通过互联网在 rhel5.1 中进行 yum

linux - (rsyslog) 过滤设施?

linux - 在 RHEL v5 64 位中为 CentOS 安装 DRBD 二进制包

amazon-ec2 - 使用 scp 将文件传输到亚马逊 ec2 实例总是给我拒绝权限(publickey,gssapi-with-mic)

amazon-web-services - 使用 pem 从 amazon aws 下载文件

linux - 无法使用 SSH 连接到 docker 容器

linux - 从本地传输到服务器时更改文件权限

从一台计算机上 SSH,在另一台计算机上继续?