Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not working scp command: Connection closed by remote host (Mac OS X)

I'm working on a remote server through Mac terminal, since I updated it to OSX 10.10 from 10.5 I started receiving this message every time I try to scp from the server to my computer:

ssh_exchange_identification: Connection closed by remote host
lost connection

If I perform scp backwards (copying from mac to server) it works just fine, and it works fine if I do it form another mac.

If I do a verobse scp, it gives me this:

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

I tried looking in the various host, config, ssh files but I didn't mange to solve much.

like image 962
gmaster Avatar asked Feb 11 '23 02:02

gmaster


1 Answers

I just had the same issues with an SCP from my personal Mac to a Mac desktop we use as a local server. Running sudo sshd -t showed me the following hint:

/var/empty must be owned by root and not group or world-writable

All I did was change the owner back to root (I'm not sure why it wasn't already, but I remember upgrading from Mavericks to Yosemite gave me a couple headaches regarding permissions):

cd /var
sudo chown root empty

I hope it helps.

like image 52
Uzaak Avatar answered Apr 28 '23 15:04

Uzaak