我正在通过Mac终端处理远程服务器,因为我从10.5中将它更新为OSX 10.10,每次我尝试从服务器到我的计算机上scp
时,我就开始接收这条消息:
ssh_exchange_identification: Connection closed by remote host
lost connection
如果我向后执行scp
(从mac复制到服务器),它会很好地工作,如果我从另一个mac执行它也会很好。
如果我做了一个verobse scp
,它会给我以下内容:
Executing: program /usr/bin/ssh host xx.xx.xx.x, user User, command scp -v -t /Users/User
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xx.xx.xx.x [xx.xx.xx.x] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug1: identity file /home/user/.ssh/identity-cert type -1
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
lost connection
我试着查看各种主机、config、ssh文件,但我没有解决太多问题。
发布于 2015-05-27 18:24:08
从我的个人Mac到我们作为本地服务器使用的Mac桌面,我只是遇到了同样的问题。运行sudo sshd -t
向我展示了以下提示:
/var/empty must be owned by root and not group or world-writable
我所做的只是将所有者改为root (我不知道为什么还没有,但我记得从小牛队升级到Yosemite给我带来了一些权限方面的麻烦):
cd /var
sudo chown root empty
希望能帮上忙。
发布于 2015-11-22 17:12:46
我也有这个问题。
我试过"sudo sshd -t“,但似乎没有问题。
然后我检查了我的"hosts.allow“和"hosts.deny",没问题。
最后,我在命令中使用了'~'路径,如下所示:
scp ~/Downloads/afile root@host2:~/Downloads
我把它改成了下面的那个:
scp /home/Downloads/afile root@host2:/home/Downloads
和它现在起作用了,希望这能帮上忙。
发布于 2015-05-19 15:04:08
检查目标用户的.bashrc
或等效文件。~/.bashrc
是为非交互式登录提供的。如果有输出任何内容的echo
或命令,它将破坏SCP协议。
https://stackoverflow.com/questions/30326594
复制相似问题