Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

Install openssh-server

sudo apt-get install openssh-server
share|improve this answer
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

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
share|improve this answer

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.

share|improve this answer

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

share|improve this answer
i had to install openssh. I thought it comes with ubuntu , its strange – John Apr 23 '10 at 5:07
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 posting your answer, you agree to the privacy policy and terms of service.