首页 > 代码库 > Linux bash: scp: command not found的问题记录

Linux bash: scp: command not found的问题记录

1,scp报错

[root@localhost soft]# scpjdk-7u55-linux-x64.tar.gz 192.168.121.246:/soft/

root@192.168.121.246‘s password:

bash: scp: command not found

lost connection

[root@localhost soft]#

 

 

2,调试-v

[root@localhost soft]# scp -vjdk-7u55-linux-x64.tar.gz 192.168.121.246:/soft/

Executing: program /usr/bin/ssh host192.168.121.246, user (unspecified), command scp -v -t /soft/

OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb2013

debug1: Reading configuration data/etc/ssh/ssh_config

debug1: Applying options for *

debug1: Connecting to 192.168.121.246[192.168.121.246] port 22.

debug1: Connection established.

debug1: permanently_set_uid: 0/0

debug1: identity file /root/.ssh/identitytype -1

debug1: identity file/root/.ssh/identity-cert type -1

debug1: identity file /root/.ssh/id_rsatype -1

debug1: identity file/root/.ssh/id_rsa-cert type -1

debug1: identity file /root/.ssh/id_dsatype -1

debug1: identity file/root/.ssh/id_dsa-cert type -1

debug1: identity file /root/.ssh/id_ecdsatype -1

debug1: identity file/root/.ssh/id_ecdsa-cert type -1

debug1: Remote protocol version 2.0, remotesoftware version OpenSSH_5.3

debug1: match: OpenSSH_5.3 pat OpenSSH*

debug1: Enabling compatibility mode forprotocol 2.0

debug1: Local version stringSSH-2.0-OpenSSH_5.3

debug1: SSH2_MSG_KEXINIT sent

debug1: SSH2_MSG_KEXINIT received

debug1: kex: server->client aes128-ctrhmac-md5 none

debug1: kex: client->server aes128-ctrhmac-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: Host ‘192.168.121.246‘ is known andmatches the RSA host key.

debug1: Found key in/root/.ssh/known_hosts:1

debug1: ssh_rsa_verify: signature correct

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

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: Unspecified GSS failure.  Minor code may provide more information

Cannot determine realm for numeric hostaddress

 

debug1: Unspecified GSS failure.  Minor code may provide more information

Cannot determine realm for numeric hostaddress

 

debug1: Unspecified GSS failure.  Minor code may provide more information

 

 

debug1: Unspecified GSS failure.  Minor code may provide more information

Cannot determine realm for numeric hostaddress

 

debug1: Next authentication method:publickey

debug1: Trying private key:/root/.ssh/identity

debug1: Trying private key:/root/.ssh/id_rsa

debug1: Trying private key:/root/.ssh/id_dsa

debug1: Trying private key:/root/.ssh/id_ecdsa

debug1: Next authentication method:password

root@192.168.121.246‘s password:

 

看到例如以下信息:

......

debug1: Host ‘192.168.121.246‘ is known andmatches the RSA host key.

debug1: Found key in/root/.ssh/known_hosts:1

debug1: ssh_rsa_verify: signature correct

debug1: SSH2_MSG_NEWKEYS sent

debug1: expecting SSH2_MSG_NEWKEYS

debug1: SSH2_MSG_NEWKEYS received

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: No valid Key exchangecontext能够看出问题应该出在接收端server上的scp问题。

 

3,去接收端121.246上面查看scp

[root@localhost ~]# type scp

-bash: type: scp: not found

[root@localhost ~]#

果然不识别scp,试试yum安装,例如以下所看到的,无效:

[root@localhost ~]# yum install -y scp

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 *base: ftp.sjtu.edu.cn

 *extras: mirrors.163.com

 *updates: centos.ustc.edu.cn

Setting up Install Process

No package scp available.

Error: Nothing to do

[root@localhost ~]#

 

baidu到,yum安装scp包,是openssh-clients,所以又一次yum安装

运行yum install openssh-clients* -y安装

 

ok。在check,scp已经能用了。例如以下所看到的

[root@localhost ~]# type scp

scp is /usr/bin/scp

[root@localhost ~]#

 

4,如今原来的server上scp就能成功了

[root@localhost soft]# scpjdk-7u55-linux-x64.tar.gz 192.168.121.246:/soft/

root@192.168.121.246‘s password:

jdk-7u55-linux-x64.tar.gz                                                                                                                                   100%  132MB 131.8MB/s   00:01   

[root@localhost soft]#

 

5,总结

scp成功,须要两个server都安装了scp服务才行。

Linux bash: scp: command not found的问题记录