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