Super User is a question and answer site for computer enthusiasts and power users. 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 have been trying to setup a ssh server on my desktop for remote access and have been running into a few issues. The first I have found is that sshd is not starting on boot. As soon as I run:

sudo service sshd start

manually I am able to ssh into the computer from itself, so I know ssh daemon is installed properly. Now I just want it to start at boot.

After looking into it I have found in


I have found a script


or something along those lines. I believe the K implies that when entering run-level 3, it is shutting down sshd. Is all I need to do to make it start is create a file S##sshd to have it restart or is there a better way to go about this. I figured I should get some more knowledgeable opinions before I ran around renaming and creating random files on a hunch.

share|improve this question
up vote 6 down vote accepted

I believe the K implies that when entering run-level 3, it is shutting down sshd

Yes. K is for Kill.

This is old SystemV style startup. The base scripts are all in init.d, and there are various symlinks with specific naming conventions (S00..., K99...) in the rc?.d directories where they're actually run from.

When you change runlevels, say from 1 to 3, the init process spawns a script that goes into the directory for the old runlevel (/etc/rc.d/rc1.d/) and run all the scripts that start with K as

K_NUMBER_some_service stop

Then you go to the directory for the new runlevel (/etc/rc.d/rc3.d in this case) and run all the scripts that start with S as

S_NUMBER_some_service start

The scripts are run in alphabetical order, the order usually determined by the NUMBER which ranges from 00-99. The order is important - you don't want to start sshd before you start networking.

In theory, if you know how to determine the number/order it should be run as, you could do the symlinks manually. Most scripts have this order number as a comment (try: head /etc/rc.d/init.d/sshd). But you're much better off using the proper tools for the job. On Redhat, there is ntsysv, and also system-config-services. If you wanted to, you could even use the command line tool chkconfig. I think

chkconfig --level 2345 sshd on

would do what you want. Verify with chkconfig --list sshd

share|improve this answer
ntsysv did it, i kinda figure digging around in the raw files with my experience level wasn't the smart way to do it. – Godric Seer May 16 '12 at 19:43

Redhat uses the ntsysv tool to enable/disable services for the rcN.d directories.

share|improve this answer

if you looking to login in runlevel 3 (which is Multi-User mode, console logins only) , all what you want to do is $ sudo init 3 . another way to do that is to add the kernel parameter "3", and to when you grub is booting press "e" to modify the kernel boot option.

WARNING: applying this to machine running on runlevel 5 (Multi-User mode, with display manager as well as console logins ) will kill X11 and force you to login in console mode.

share|improve this answer

You must log in to answer this question.

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