您的位置:首页 > 其它

scp文件到远端服务器提示 command not found

2015-12-08 22:02 435 查看
一台新的服务器,准备源码安装一些软件,使用scp复制文件时提示bash: scp: command not found

排查了一下,发现是对端系统没有安装openss-client软件包,导致scp复制文件到对端的时候,报找不到命令的错误

[10:28:48 talen@BJB0300 ~ ]$ scp bash-4.2.tar.gz root@10.10.56.11:
root@10.10.56.11's password:
bash: scp: command not found
lost connection

本地是有scp命令的,密码输入也是正确的
加-v参数查看详细过程,认证已经通过,判断应该是远端服务器的scp命令没有安装.

[10:30:07 talen@BJB0300 ~ ]$ scp -v bash-4.2.tar.gz root@10.10.56.11:
Executing: program /usr/bin/ssh host 10.10.56.11, user root, command scp -v -t -- .
OpenSSH_5.8p2, OpenSSL 1.0.0j-fips 10 May 2012
debug1: Reading configuration data /home/talen/.ssh/config
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.10.56.11 [10.10.56.11] port 22.
debug1: Connection established.
debug1: identity file /home/talen/.ssh/id_rsa type 1
debug1: identity file /home/talen/.ssh/id_rsa-cert type -1
debug1: identity file /home/talen/.ssh/id_dsa type -1
debug1: identity file /home/talen/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.8
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA 7e:48:73:29:db:0e:72:74:1d:6e:93:e7:01:e9:32:6a
debug1: Host '10.10.56.11' is known and matches the RSA host key.
debug1: Found key in /home/talen/.ssh/known_hosts:32
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: An invalid name was supplied
Cannot determine realm for numeric host address
debug1: An invalid name was supplied
Cannot determine realm for numeric host address
debug1: An invalid name was supplied
debug1: An invalid name was supplied
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/talen/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/talen/.ssh/id_dsa
debug1: Next authentication method: password
root@10.10.56.11's password:
debug1: Authentication succeeded (password).
Authenticated to 10.10.56.11 ([10.10.56.11]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env XMODIFIERS = @im=ibus
debug1: Sending env LANG = zh_CN.UTF-8
debug1: Sending env LANGUAGE =
debug1: Sending command: scp -v -t -- .
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 2000, received 2104 bytes, in 0.5 seconds
Bytes per second: sent 4303.3, received 4527.0
debug1: Exit status 127
lost connection
[10:31:41 talen@BJB0300 ~ ]$


在远端服务器安装scp命令

[root@talenpc ~]# yum install openssh-clients


一切正常了.

[10:36:49 talen@BJB0300 ~ ]$ scp bash-4.2.tar.gz root@10.10.56.11:
root@10.10.56.11's password:
bash-4.2.tar.gz                                                                        100% 6845KB   6.7MB/s   00:01
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: