A question from my email bag:
How do changing run levels affect us or our users?
If you are moving to higher run levels, you may make additional services available to users, while moving to a lower run level will causes to services (daemons) to become unavailable. On the production server run level 3 is the normally used and rarely changed. However, some administrative tasks require the administrator to move system to run level 1 i.e single user mode.
Linux Find Out Current Run Level Command
Type the following command:
$ who -r
run-level 2 2011-10-12 05:38
Linux Change Run Level Command
Use the init command to change rune levels:
# init 1
Runlevel And Its Usage
The Init is the parent of all processes with PID # 1. Its primary purpose is to create processes from a script stored in the file /etc/inittab file. This file usually has entries which cause init to spawn gettys on each line that users can log in. A runlevel is nothing but a software configuration of the Linux system which allows only a selected group of processes to exist. The processes spawned by init for each of these runlevels are defined in the /etc/inittab file. Init can be in one of eight runlevels as follows:
- Runlevel 0 is halt
- Runlevel 1 is single-user
- Runlevels 2-5 are multi-user (some distro uses RUN level 5 to start X [KDE/Gnome])
- Runlevel 6 is for rebooting system
For example, typing the init 3 command will move system to run level 3:
# init 3
On most Linux server system default run level is 3 and on most Linux Desktop system default run level is 5. The default run level is defined by the initdefault line at the top of /etc/inittab file under CentOS / Fedora / Redhat / RHEL / Debian Linux. To change the default run level, edit /etc/inittab file, and edit entry initdefault:
# vi /etc/inittab
Set initdefault to 5, so that you can boot to X next time when Linux comes up:
Save and close the file. Reboot the system to see changes:
More About getty
getty is the program which opens a tty port, prompts for a login name and password (via /bin/login command). Your console displays a login/password prompt at run levels 1 through 6. You can use ALT+F1...ALT+F6 keys to switch console (use CTRL+ALT+F1..F6 under X windows).
SSH logins are handled by OenSSH (sshd) server which starts at run level 2/3. KDE/Genome Desktop login are handled by GDM/XDM/KDM display manager which starts at run level 5 (however Debian Linux and some other distro can start them from run level 2 via special rc.d script located in /etc/init.d/gdm)
Updated for accuracy!Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?