SCP command "Bash:scp:command not found lost connection" solution

Source: Internet
Author: User
Tags redis ssh scp command


In the SCP times Bash:scp:command not found
[root@51ou.com add_admin]# SCP Ocp_admin_privileges.mysql root@10.10.1.128:/root
root@10.10.1.128 ' s Password:
Bash:scp:command not found
Lost connection

To see if the Openssh-clients package is installed on this computer

[Root@51ou.com add_admin]# rpm-q openssh-clients

If not, we need to install

All of the machines I have minimized installation, so many components are not installed is also reasonable, so use Yum to install the SCP:

Yum-y Install Openssh-clients

After loading, continue to execute the previous command, resulting in the following error:


[Root@cache-ns-4 etc]# SCP redis.conf root@192.168.17.125:/usr/local/redis/etc/
root@192.168.17.125 ' s Password:
Bash:scp:command not found
Lost connection
[Root@cache-ns-4 etc]# Whereis SCP
SCP:/usr/bin/scp/usr/share/man/man1/scp.1.gz

I rub it, it's weird! Did you pretend that there was no hint of Mao? And also prompted to enter the password, with Whereis can also find the SCP, there is no way to find a debug parameter-V from the man, and then add the-v parameter to perform the following test:

[Root@cache-ns-4 etc]#/usr/bin/scp-v redis.conf root@192.168.17.125:/usr/local/redis/etc/
EXECUTING:PROGRAM/USR/BIN/SSH host 192.168.17.125, user root, command scp-v-t/usr/local/redis/etc/
OPENSSH_5.3P1, OpenSSL 1.0.1e-fips Feb 2013
Debug1:reading Configuration Data/etc/ssh/ssh_config
Debug1:applying Options for *
Here are omitted several lines
root@192.168.17.125 ' s Password:
Debug1:authentication succeeded (password).
Debug1:channel 0:new [Client-session]
Debug1:requesting no-more-sessions@openssh.com
Debug1:entering Interactive session.
debug1:sending environment.
debug1:sending env LANG = en_US. UTF-8
#关键信息来了, this side will be the SCP command send to each other, the other side suggested that the SCP did not find, reason to get out!
Debug1:sending command:scp-v-t/usr/local/redis/etc/
Bash:scp:command not found
Debug1:client_input_channel_req:channel 0 Rtype exit-status reply 0
Debug1:client_input_channel_req:channel 0 Rtype eow@openssh.com reply 0
Debug1:channel 0:free:client-session, Nchannels 1
DEBUG1:FD 0 Clearing O_nonblock
DEBUG1:FD 1 Clearing O_nonblock
Transferred:sent 1624, received 2096 bytes, in 0.2 seconds
Bytes per Second:sent 9088.1, received 11729.5
Debug1:exit Status 127
Lost connection
[Root@cache-ns-4 etc]#

The original is because the target host did not install SCP, but I careless! After landing, perform the following command again to install the SCP:


Yum-y Install Openssh-clients

Back to the previous server, the implementation of the original command, and sure enough, no surprise success:


[Root@cache-ns-4 etc]#/USR/BIN/SCP redis.conf root@192.168.17.125:/usr/local/redis/etc/
root@192.168.17.125 ' s Password:
redis.conf 100% 35KB 35.3kb/s 00:00
[Root@cache-ns-4 etc]#

Web site Search This failure, most of the experience is told to install the SCP, and then give a yum online installation of the SCP command. In fact, obviously has been prompted to enter the password, the SCP is a normal installation! and continued to report that no orders were found, we can only analyze it from the implementation process of the SCP, so with the help of the SCP debug parameter (-V), it is clear that the entire execution process is visible, so that the real reason is that the other host does not have the SCP installed, and can clearly see the workflow of the SCP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.