手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

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

[日期:2015-07-30] 来源:Linux公社  作者:黄杉 [字体: ]

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可以看出问题应该出在接收端服务器上的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,现在原来的服务器上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成功,需要两个服务器都安装了scp服务才行。

本文永久更新链接地址http://www.linuxidc.com/Linux/2015-07/120766.htm

linux
相关资讯       Linux Bash  Linux scp 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款