Welcome 微信登录

首页 / 操作系统 / Linux / 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 foundlost 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 Feb2013debug1: Reading configuration data/etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 192.168.121.246[192.168.121.246] port 22.debug1: Connection established.debug1: permanently_set_uid: 0/0debug1: identity file /root/.ssh/identitytype -1debug1: identity file/root/.ssh/identity-cert type -1debug1: identity file /root/.ssh/id_rsatype -1debug1: identity file/root/.ssh/id_rsa-cert type -1debug1: identity file /root/.ssh/id_dsatype -1debug1: identity file/root/.ssh/id_dsa-cert type -1debug1: identity file /root/.ssh/id_ecdsatype -1debug1: identity file/root/.ssh/id_ecdsa-cert type -1debug1: Remote protocol version 2.0, remotesoftware version OpenSSH_5.3debug1: match: OpenSSH_5.3 pat OpenSSH*debug1: Enabling compatibility mode forprotocol 2.0debug1: Local version stringSSH-2.0-OpenSSH_5.3debug1: SSH2_MSG_KEXINIT sentdebug1: SSH2_MSG_KEXINIT receiveddebug1: kex: server->client aes128-ctrhmac-md5 nonedebug1: kex: client->server aes128-ctrhmac-md5 nonedebug1:SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_GROUPdebug1: SSH2_MSG_KEX_DH_GEX_INIT sentdebug1: expecting SSH2_MSG_KEX_DH_GEX_REPLYdebug1: Host "192.168.121.246" is known andmatches the RSA host key.debug1: Found key in/root/.ssh/known_hosts:1debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue:publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Next authentication method:gssapi-keyexdebug1: No valid Key exchange contextdebug1: Next authentication method:gssapi-with-micdebug1: Unspecified GSS failure.  Minor code may provide more informationCannot determine realm for numeric hostaddress debug1: Unspecified GSS failure.  Minor code may provide more informationCannot determine realm for numeric hostaddress debug1: Unspecified GSS failure.  Minor code may provide more information  debug1: Unspecified GSS failure.  Minor code may provide more informationCannot determine realm for numeric hostaddress debug1: Next authentication method:publickeydebug1: Trying private key:/root/.ssh/identitydebug1: Trying private key:/root/.ssh/id_rsadebug1: Trying private key:/root/.ssh/id_dsadebug1: Trying private key:/root/.ssh/id_ecdsadebug1: Next authentication method:passwordroot@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:1debug1: ssh_rsa_verify: signature correctdebug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue:publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Next authentication method:gssapi-keyexdebug1: No valid Key exchange contextdebug1: 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 scpLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile *base: ftp.sjtu.edu.cn *extras: mirrors.163.com *updates: CentOS.ustc.edu.cnSetting up Install ProcessNo 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 scpscp 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服务才行。本文永久更新链接地址