2021-05-12 14:32:11
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可以看出問題應該出在接收端伺服器上的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
相關文章