Server Administration & Management

SSH deamon failing to start

Sometimes the sshd service may be fails, we have check everything, looked fine and reinstall of the service did not work either. There was no error shown at service start-up, but the service status showed it was down :

# /etc/init.d/sshd start
Starting sshd: [ OK ]
# /etc/init.d/sshd status
openssh-daemon is stopped

I checked the /var/log/secure logs to see what error is being thrown and it showed below error :

Sep4 13:54:54 vps sshd[18431]: fatal: daemon() failed: No such device

I had to do some search to find out which device its referring to in this error,  it turned out that its related to /dev/null which is supposed to be a proper character device and not a regular file. In this case it was a regular file so I removed it and recreated the character device as below :

# rm -f /dev/null

# mknod /dev/null c 1 3

Once the character device is created the permissions should look like below :

# ls -lh /dev/null
crw-rw-rw- 1 root root 1, 3 Jan 12 16:07 /dev/null

After this was confirmed that /dev/null is a proper character device , I restarted the service and it came up fine this time :

# /etc/init.d/sshd start
Starting sshd: [ OK ]
# /etc/init.d/sshd status
openssh-daemon (pid 27662) is running…

So if you came across this error for ssh service failure, then make sure that /dev/null is a proper character device, recreating that as proper character device should fix the issue.

September 5, 2011 Posted by | SSH | | Leave a comment