Ubuntu: sshd won't stop/start properly



Question:

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.


Solution:1

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.


Solution:2

try

service sshd stop  service sshd start  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »