How to Fix “scp: command not found” on CentOS 6.2/RHEL 6

I get the following error when I try to use SCP command line on CentOS linux server. SCP command is usually used to safely copy files and directories between the remote host without FTP sessions or log in to a remote system directly. SCP command line utility uses SSH to transfer data, so it requires a password or passphrase for confirmation before proceeding with the transfer.

-bash: scp: command not found

The above issue is related to openshh. There are two openssh packages that usually exist on the linux, openssh-server and openssh-clients. You can use the telnet command to check whether the openssh server has been installed or not.

[root@centos62 ~]# telnet localhost 22
Trying ::1...
Connected to localhost.
Escape character is '^]'.

Above telnet command shows that openssh-server has been installed. Therefore, the problem on “scp: command not found” is due to openssh-clients not installed.

READ  How to Properly Shutdown and Reboot Linux CentOS 5/CentOS 6/RHEL 5/RHEL 6

Verify the installed package :

[root@centos62 ~]# rpm -qa | grep openssh-*

To install openssh-clients, execute the following command :

[root@centos62 ~]# yum install openssh-clients -y

Then try to run scp command :

[root@centos62 ~]# 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

If you have been returned to the scp message above, that’s mean your openssh-clients package has been installed successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>