The numbers associated with the run levels for a specific distribution are listed in the /etc/inittab
#/etc/inittab (in RHEL 3)
# Default runlevel. The runlevels used by RHS are:
# 0 – halt (Do NOT set initdefault to this)
# 1 – Single user mode
# 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 – Full multiuser mode
# 4 – unused
# 5 – X11
# 6 – reboot (Do NOT set initdefault to this)
# System initialization.
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
Choose the good runlevel:
it will shutdown your system
It is the single user mode, used by system administrator when you have to fix some problems and everything is going wrong. you’ll be root without password.
Very useful if you forgot your root password, but you have to protect the physical acces to your server.
No user can log in while you are in this runlevel
It is a multi user mode in command line (like the runlevel3) but you don’t have network connection
It is the full multiuser command line mode. (mainly used by every one)
I think it is not really used maybe you can configure it for special purposes…
It is the full multiuser X11 mode.
It will reboot your server
The good choice:
Depending on the server utilisation you have, you’ll choose runlevel 3 or 5
The (very) bad one:
You mustn’t change the initdefault to runlevel 0 (halt) or runlevel 6 (reboot)
because the system will then either immediately shutdown just after starting, or reboot indefinitely….
Changing the inittab configuration:
To make a change you can either edit the conf. file /etc/inittab or use the comand ‘telinit’
[admin@nuxora admin]$man telinit
#…. this is an extract ….
/sbin/telinit is linked to /sbin/init. It takes a one-character argu-
ment and signals init to perform the appropriate action. The following
arguments serve as directives to telinit:
0,1,2,3,4,5 or 6
tell init to switch to the specified run level.
a,b,c tell init to process only those /etc/inittab file entries having
runlevel a,b or c.
Q or q tell init to re-examine the /etc/inittab file.
S or s tell init to switch to single user mode.
U or u tell init to re-execute itself (preserving the state). No re-
examining of /etc/inittab file happens. Run level should be one
of Ss12345, otherwise request would be silently ignored.
telinit can also tell init how long it should wait between sending pro-
cesses the SIGTERM and SIGKILL signals. The default is 5 seconds, but
this can be changed with the -t sec option.
telinit can be invoked only by users with appropriate privileges.
If the key combination CTRL-ALT-DEL is trapped by one entry in /etc/inittab
then the shutdown command will be called when you’ll press ctrl+alt+del
Everyone who has physical access to the console keyboard could shut the system down.
It will also check if the user is allowed to execute a ‘shutdown’. To prevent this, you can
drop this line from /etc/inittab or modify the execution script:
ca::ctrlaltdel:echo “shutdown is not allowed pressing ctrl + alt + del”