I'm very new to Linux, BTW. The ultimate goal for me is to run applications and their GUIs on a (Mac) computer from another computer. The first step is to just use SSH to access and control the computer using another computer and the terminal. This was working fine.

The next step was to install XQuartz on the server and terminal to be able to see and use GUI on the other computer. Regular SSH control worked but not the GUI. Apparently, the DISPLAY variable was not set correctly and this was probably due to the fact that X11Forwarding was set to no in the sshd.config file. I changed it to yes; regular SSH still worked but the DISPLAY was still wrong and GUI did not appear. So, I read that I had to restart the SSH service and I found a way to do it:

sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist

This screwed something up, because now I can't even do regualr ssh control. I tried to both unload and load, this gives different error messages in the terminal:

When I run (on the other computer):

sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

I instantly get:

ssh_exchange_identification: Connection closed by remote host

Then I tried to undo the damage:

sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist

Then I, after some time (about 3 seconds), get:

ssh: connect to host macpro-c10c8b.imt.liu.se port 22: Connection refused

What have I done, and how can I fix it?

  • This is not a forum, it is a Q&A site. Please read through the help→tour, including the part no chit-chat (like Thanks, emoticons and other non-question related stuff). – Anthon Mar 31 '15 at 18:21
  • Post the sshd config for your mac computer - in your question, not in a comment, please. This is the one you are trying to connect to, and which produces the second to last line: ssh: connect to host macpro-c10c8b.imt.liu.se port 22: Connection refused, correct? – Faheem Mitha Mar 31 '15 at 18:59

You should try looking in the logs of sshd, somehow you've come with invalid SSHD configuration, here is some guide on it: http://linux.die.net/man/5/sshd_config look where sshd is logging stuff and look there for potential issue why it is not running for you.

This "ssh: connect to host macpro-c10c8b.imt.liu.se port 22: Connection refused" should guide you there is no sshd running on macpro-c10c8b.imt.liu.se (probably your Linux box) which is why the command fails.

| improve this answer | |

The problem is solved, we had changed the extension of sshd.config to sshd.config.txt. This did not have an effect until I did the unload/load command. This is why I blamed the unload/uload function. Changed the name back to normal, restarted the ssh service and now it works.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.