scp-lost-connection

debug the reason

[root@catfish ~]# scp -v /etc/samba/smb.conf root@192.168.68.9:/etc/samba/
Executing: program /usr/bin/ssh host 192.168.68.9, user root, command scp -v -t /etc/samba/
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.68.9 [192.168.68.9] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa 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.3
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: Host '192.168.68.9' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:3
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: 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: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
root@192.168.68.9's password:

From above log ,it showed :

debug1: Next authentication method: gssapi-with-mic
debug1: An invalid name was supplied
Cannot determine realm for numeric host address

So ,the we need to change GSS autherization

Three method to fix such error

## method 1
scp -o GSSAPIAuthentication=no file remote-ip:/tmp/

## method 2
[ !-f /home/colin/.ssh/config ] && touch /home/colin/.ssh/config
echo "GSSAPIAuthentication no" > /home/colin/.ssh/config
Note : this method only for current user `colin`

## method 3
sed -i 's/#   GSSAPIAuthentication no/GSSAPIAuthentication no/' /etc/ssh/ssh_config
/etc/init.d/sshd restart

Attachment

Sometimes when you try to use scp command ,but find there was no such one , and try use yum install scp to install and met error No package scp available.

The reason is the command scp located in package openssh-clients, if you want to install scp, you need to try with yum install -y openssh-clients

And then debug again, no such waiting error. Fix successfully !

    原文作者:全栈运维
    原文地址: https://www.jianshu.com/p/decf59cd4ef4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞