Error using scp command "bash: scp: command not found"

I want to use the scp command to copy a local file to a remote server, but I get an error after entering the user password on the remote server.

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

I checked the server using the git user, and it seems that the scp command can be found, and openssh-clinets were also installed.

 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. 

I am confused about the situation. I didn’t have any configuration on the server? (We use RHEL6 as a server.)




This is my mistake in setting the path. I added 'custom.sh' to /etc/profile.d and added the following lines in it to add the / usr / local / node / bin directory to PATH.

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

But the format is wrong. I removed the pair "" and now it works fine. It should be:

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

Probe Error ... ^ _ ^

+43
scp rhel openssh
Jun 16 '13 at 7:15
source share
3 answers

Make sure the scp command is available on both sides - both on the client and on the server.

If it is Fedora or Red Hat Enterprise Linux and clones (CentOS), make sure that this package is installed:

  yum -y install openssh-clients 

If you are working with Debian or Ubuntu and clones, install this package:

  apt-get install openssh-client 

Again, you need to do this both on the server and on the client, otherwise you may encounter "strange" error messages on your client: scp: command not found or similar, although you have it locally. It has already embarrassed thousands of people, I think :)

+85
Nov 27 '13 at 12:10
source share

The problem with the remote server, you can log in to the remote server and check if "scp" works

probable reasons: - scp is not in the way - openssh client is not installed correctly

for more details http://www.linuxquestions.org/questions/linux-newbie-8/bash-scp-command-not-found-920513/

+3
Jun 16 '13 at 7:20
source share

Check if scp installed or not from where you want to copy check with which scp

If it is already installed, it will print the path for you, for example /usr/bin/scp Else, install scp using:

 yum -y install openssh-clients 

Then copy the command

 scp -r root@192.168.1.1:/var/www/html/database_backup/restore_fullbackup/backup_20140308-023002.sql /var/www/html/db_bkp/ 
+3
Mar 09 '14 at 6:05
source share



All Articles