2

I am running ubuntu 13.10 (fresh install). I have installed openssh-server. During the process of trying to troubleshoot a problem with logging in via ssh from another linux system (also running ubuntu) I discovered that stopping and starting the server don't seem to work properly. I have googled the problem extensively and found many (sometimes conflicting) answers. Below are the results for the four methods I have found

root@newton:~# invoke-rc.d ssh stop
initctl: Unknown job: ssh
root@newton:~# service ssh stop
stop: Unknown job: ssh
root@newton:~# /etc/init.d/ssh stop
root@newton:~# 
root@newton:~# stop ssh
stop: Unknown job: ssh

In no case do I get feedback that indicates the daemon stopped. The same goes for trying to start the daemon. When I look at /var/log/auth.log I see that the daemon apparently stopped multiple times but not because of the above commands. It only stops when I kill it using killall sshd. After which it immediately restarts. Somehow something appears to be completely broken with my system. Does anyone have any ideas on how to sort it out? Thanks for any help.

5
  • can you try ls /etc/init.d/ssh ?
    – OYRM
    Jan 10, 2014 at 5:33
  • Here is the result of ls -l /etc/init.d/ssh: -rwxr-xr-x 1 root root 4077 May 21 2013 /etc/init.d/ssh
    – user234017
    Jan 10, 2014 at 6:27
  • How about sudo service ssh status ?
    – OYRM
    Jan 10, 2014 at 6:36
  • Can you try sudo apt-get -reinstall install openssh-server?
    – jobin
    Jan 10, 2014 at 8:01
  • @OYRM and Jobin I posted an answer. I just wanted to let you know. Thanks for your help.
    – user234017
    Jan 10, 2014 at 18:42

2 Answers 2

4

Thanks to all who have posted trying to help me sort this out. I wanted to update all on the current status and explain what I did to put the system in its current state. You will notice in the original post that I tried sudo service ssh start, etc. and obtained various unhelpful errors. Eventually, I did

#touch /etc/ssh/sshd_not_to_be_run

and then

# killall sshd

a few times. At this point sshd stopped restarting (as you would expect). I then ran

sudo service ssh status
ssh stop/waiting  

sudo service ssh start  
ssh stop/pre-start, process 22510  

sudo service ssh status  
ssh stop/waiting  

sudo service ssh stop  
stop: Unknown instance:   

sudo service ssh status  
ssh stop/waiting  

sudo service ssh start    
ssh stop/pre-start, process 22579    

sudo service ssh status    
ssh stop/waiting

These results are expected given the presence of sshd_not_to_be_run file. After subsequently removing this file I was able to run:

sudo service ssh status
ssh stop/waiting

sudo service ssh start
ssh start/running, process 25063

sudo service ssh status
ssh start/running, process 25063

sudo service ssh stop
ssh stop/waiting

sudo service ssh start
ssh start/running, process 25141

sudo service ssh status
ssh start/running, process 25141

sudo service ssh stop
ssh stop/waiting

sudo service ssh start
ssh start/running, process 25247

It looks like things are in order for now. If anyone has any ideas about tests that I could to to help ubuntu sort this out (I have seen several other posts on the web that indicate the errors I was originally getting) I would be happy to do them and post results. Thanks again for all of your help.

3
  • 2
    how creating the file /etc/ssh/sshd_not_to_be_run is supposed to help ? I have exactly the same issue, and your solution doesn't work !
    – vcarel
    Apr 22, 2014 at 12:50
  • @vcarel I have this line in my /etc/init/ssh.conf: test -e /etc/ssh/sshd_not_to_be_run && { stop; exit 0; }
    – sebix
    Feb 17, 2016 at 10:54
  • For me, none of the above worked, not even this which worked for some users, however this did: sudo killall sshd; sudo mkdir /var/run/sshd; sudo /usr/sbin/sshd -D & May 26, 2016 at 19:36
1

try

service sshd stop
service sshd start
3
  • 1
    stop: Unknown job: ssh
    – vcarel
    Apr 22, 2014 at 12:51
  • 1
    start: Unknown job: ssh
    – vcarel
    Apr 22, 2014 at 12:51
  • Use sudo even you are in root user. This works for me
    – Bruce Yo
    Apr 28, 2016 at 4:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .