scp command not found in CentOS and Red Hat

After doing minimal installation of CentOS 6.3 server ,we were not able to do scp from my client machine to CentOS server.It was simply showing the error – “scp command not found”. This thing has happened earlier when we have used the CentOS 6.
When it was occur last time with us in CentOS 6.0 it was due to Env set in /etc/profile.

Now today we got the error because of some other Reason.

To solve the problem. Install the openssh-clients packages in CentOS server.
Use the below command.

yum install openssh-clients

Error output:

linux@tuxworld:/tmp$ scp test root@192.168.56.20:~
root@192.168.56.20's password: 
bash: scp: command not found
lost connection
linux@tuxworld:/tmp$ 

You may be wondering how we get the conclusion to install only openssh-clients package in the system.

The answer is very simple, in Red Hat/CentOS we can search the package which provides the particular command. For more information on this, read our post yum : how to find rpm package which has certain command or file

Here we will search for the package which provides the command ‘scp’.

yum whatprovides "*/scp"

In below output, we can find that /usr/bin/scp is associated with package called ‘openssh-clients’ and hence we only install this package.

[root@centos-linuxworld ~]# yum whatprovides "*/scp"
Loaded plugins: fastestmirror
base                                                                                                                     | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                                     |  14 kB  00:00:00     
epel                                                                                                                     | 4.3 kB  00:00:00     
extras                                                                                                                   | 3.4 kB  00:00:00     
mariadb                                                                                                                  | 2.9 kB  00:00:00     
updates                                                                                                                  | 3.4 kB  00:00:00     
(1/2): epel/x86_64/primary_db                                                                                            | 4.5 MB  00:00:00     
(2/2): epel/x86_64/updateinfo                                                                                            | 733 kB  00:00:02     
Loading mirror speeds from cached hostfile
 * base: ftp.osuosl.org
 * epel: fedora-epel.mirrors.tds.net
 * extras: ftp.osuosl.org
 * updates: ftp.osuosl.org
epel/x86_64/filelists_db                                                                                                 | 7.5 MB  00:00:00     
extras/7/x86_64/filelists_db                                                                                             | 423 kB  00:00:00     
mariadb/filelists_db                                                                                                     |  73 kB  00:00:00     
updates/7/x86_64/filelists_db                                                                                            | 1.5 MB  00:00:00     
1:bash-completion-extras-2.1-11.el7.noarch : Additional programmable completions for Bash
Repo        : epel
Matched from:
Filename    : /usr/share/bash-completion/completions/scp



openssh-clients-6.6.1p1-31.el7.x86_64 : An open source SSH client applications
Repo        : base
Matched from:
Filename    : /usr/bin/scp



openssh-clients-6.6.1p1-33.el7_3.x86_64 : An open source SSH client applications
Repo        : updates
Matched from:
Filename    : /usr/bin/scp



rubygem-net-scp-1.2.1-1.el7.noarch : A pure Ruby implementation of the SCP client protocol
Repo        : epel
Matched from:
Filename    : /usr/share/gems/gems/net-scp-1.2.1/lib/net/scp



openssh-clients-6.6.1p1-25.el7_2.x86_64 : An open source SSH client applications
Repo        : @updates
Matched from:
Filename    : /usr/bin/scp



[root@centos-linuxworld ~]#

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.