使用scp命令时出错“bash:scp:command not found”

我想使用scp命令将本地文件复制到远程服务器,但是在远程服务器上input用户密码后出现错误信息。

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

我使用git用户检查服务器,似乎可以findscp命令,并安装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. 

我对这个情况感到困惑。 我错过了服务器上的一些configuration? (我们使用RHEL6作为服务器。)


这是我的错误path设置。 我在/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: command not found或类似,尽pipe你在本地有。 这已经困惑了成千上万的人,我想:)

问题是与远程服务器,您可以login到远程服务器,并检查“scp”是否工作

可能的原因: – SCP不在path – openssh客户端安装不正确

了解更多详情http://www.linuxquestions.org/questions/linux-newbie-8/bash-scp-command-not-found-920513/

检查scp是否安装你想从哪里复制检查使用which scp

如果已经安装,它会打印一个像/usr/bin/scp的path。否则,使用以下命令安装scp:

 yum -y install openssh-clients 

然后复制命令

 scp -r root@192.168.1.1:/var/www/html/database_backup/restore_fullbackup/backup_20140308-023002.sql /var/www/html/db_bkp/