I want to restart ssh or sshd but I get this error:

qqqq@Matrix-Server:/$ sudo /etc/init.d/ssh stop
sudo: /etc/init.d/ssh: command not found

Do I need to install ssh or sshd or does it come with Ubuntu?


Install openssh-server

sudo apt-get install openssh-server
  • After you install openssh-server, you may need to run sudo initctl reload-configuration before you can sudo service ssh start. I think this is a bug in recent versions of ubuntu (12.10,13.04). – chrishiestand Jun 29 '13 at 0:09

The sshd is the ssh server deamon. So if you want to connect to a machine via ssh you need to install a ssh server on your target machine, e.g. using

sudo apt-get install openssh-server

The command ssh is what you use to actually connect to a machine running an ssh server. You need ssh installed on the machine that you want to ssh from.

sudo apt-get install ssh

But ssh will probably already be installed if you use any decent version of Ubuntu.

Now about restarting. What do you want to restart? If you want to restart the ssh server on the other machine (e.g. if you changed the config) use

sudo /etc/init.d/ssh restart

Yes it is called ssh although the process is called sshd which might be confusing.


There's an option in Ubuntu installing procedure to automatically install SSH server, if have not choosen it you need to install the package. The complete Ubuntu SSH package includes both server daemon and client.
To install it

sudo apt-get install ssh

Often the service is named after the daemon. Try /etc/init.d/sshd instead.

  • i had to install openssh. I thought it comes with ubuntu , its strange – John Apr 23 '10 at 5:07
  • 6
    No, Ubuntu uses /etc/init.d/ssh. The default install comes with the openssh client, but not the openssh server. – andol Apr 23 '10 at 5:14
  • even ssh was also not present in init.d directory . when i installed openssh then it came in that directory – John Apr 23 '10 at 5:28

Your Answer

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