This is my first server I have set up and I used ubuntu 14.04 to run it. I opted not to use the server install because the regular ubuntu was easier to setup. Now I wanted to make the server available for SSH and VNC so that I could manage it remotely and disconnect the monitor, but I can not figure either of them out. I installed openSSH server but every time I try to connect with my mac it says "connection closed by server IP" It is seriously the most frustrating thing because everywhere I look online it just says install OpenSSH and it should work. I dont completely understand the modifications to the sshd_config page or if I actually need to modify it for everything to work. I have pinged both ways and both work. I can connect to my mac from the ubuntu server but not the other way. All firewalls are off. Can someone please help me?

  • which ssh client are you using? are you having problems on non-mac's as well? do you have any routers between your ubuntu server and your client computer? – Jakke Jul 2 '14 at 6:04

You need to start the service on the ubuntu server, just use the following command

service sshd start
  • Since the OP already installed SSH service, I'd ask the OP to start the service first using this but before the to check the status too. It will be nice if you could add status command too along with the sudo option. Because, without being root you neither can start nor check the status. :) – AzkerM Jul 2 '14 at 5:29

Below is what to do after installing the openssh-server on 14.04 Trusty Tahr.

You can change the port, disable root login and other useful things by editing the config file:
sudo gedit /etc/ssh/sshd_config

Finally restart the ssh server to take place:
sudo /etc/init.d/ssh restart

More information on sshd_config can be found here.


Chech if you did install openssh-server server .

sudo apt-get install openssh-server

then check you have proper port enabled


if you go in it with different port number from outside or your router has a rule of forwarding it to another port

you may also need to uncomment in there if you want to be authorized by password.

PasswordAuthentication yes


Check /etc/ssh/sshd_config for one of the following,

  1. LoginGraceTime and make sure that is set to a time limit that you can enter your password. Otherwise it will close the connection if your request doesn't get authenticated within the timeframe. (example: this will give you a 1min window, LoginGraceTime 60)
  2. "UseDNS no" will make sure sshd would not try to resolve the hostname. If the ssh client computer and the server are using two different nameservers and they point to different IPs for the same hostname might end up locking you out. So "UseDNS no" would resolve such problems.
  3. "PasswordAuthentication yes" will make sure the SSHd accepts user entered passwords.

Also make sure the bash_profile/bashrc scripts that are used by the user you login as to the remote server ( ssh user@host.com ) don't have any exit commands used within those scripts. Otherwise as soon as you login it will close the connection.

That's all I have come across for this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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