Take the 2-minute tour ×

How do I stop/start ssh in version 11.10? I've tried

/etc/init.d/ssh restart
sudo service ssh restart
sudo restart ssh

I get errors every time... arrrr!

share|improve this question
What errors do you get? –  Florian Diesch Feb 13 '12 at 16:51
jorge@nixboxen:~$ sudo service ssh stop [sudo] password for jorge: stop: Unknown instance: jorge@nixboxen:~$ jorge@nixboxen:~$ jorge@nixboxen:~$ sudo /etc/init.d/ssh stop Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service ssh stop Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the stop(8) utility, e.g. stop ssh jorge@nixboxen:~$ –  mia_tech Feb 13 '12 at 16:57

4 Answers 4

It should be as simple as (tested on a fresh install with openssh-server)

sudo stop ssh
sudo start ssh

As it leverages upstart, this is The Best Way™ to do it, rather than using /etc/init.d/ssh, service, or invoking sshd directly. Make sure to run both commands; if you get an error on stop ssh, start ssh anyway and see what it says—the service could already be stopped.

(I would recommend stop/start over restart, unless you are trying to restart a system remotely. If ssh is already stopped, restart will not start it.)

If those commands don't work, you are probably either experiencing a bug or have tinkered too far with your system, in which case you at least know what the problem isn't.

share|improve this answer

First check to see if sshd is running using the following:

ps -ef | grep sshd

You should see something like:

root      1234     1  0 12:28 ?        00:00:00 /usr/sbin/sshd -D

If you do not see a line for /usr/sbin/sshd -D then sshd was either never started or has crashed, which will require further troubleshooting to find out why.

If you do see that line, next run this:

cat /var/run/sshd.pid

This should print the process id of sshd, so in this case you should see:

userid@computername:~$ cat /var/run/sshd.pid 

If the contents of sshd.pid does not match the process id of the running instance of sshd then something has restarted it incorrectly. But whatever the details you find here should put you on the right track. Either it's crashing, being restarted incorrectly, or never being started in the first place.

share|improve this answer

I think that the Unknown instance error is because SSH is not running.


ps ax | grep sshd

To see if the SSH daemon is running or not, you should see something like:

/usr/sbin/sshd -D

In any case, just try any of these:
sudo /etc/init.d/ssh start
sudo start ssh

share|improve this answer

The second "error" is not an error. It work just as well but tells you about another way of stopping ssh. As the message indications, you can use sudo stop ssh as an alternative.

share|improve this answer
jorge@nixboxen:~$ sudo stop ssh [sudo] password for jorge: stop: Unknown instance: –  mia_tech Feb 13 '12 at 17:28
I had to restart the computer and that's how I restarted the service... –  mia_tech Feb 14 '12 at 16:44

Your Answer


