About nixCraft

Topics

Linux Changing Run Levels

Posted by Vivek Gite [Last updated: September 3, 2008]

Recently I was taking class for Linux sys admin course. Some one asked me "How do changing run levels affect us or our users?" I replied with following answer:
Well 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 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.

Use the init command to change rune levels:

# init 1

Runlevel and usage:

Typing init 3 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. So if you wanna change default run level open file /etc/inittab and edit entry initdefault:

# vi /etc/inittab

Set initdefault to 5, so that you can boot to X next time when Linux comes up:

id:5:initdefault:

Save file and reboot to see changes.

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).

However my experience so far is that students get confused with ssh and KDE/Gnome Desktop login.
SSH logins are handled by 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)

Related articles:

E-mail this to a Friend    Printable Version

Is your site working? Monitor Your Web Site 24/7. Get SMS alerts on server downtime. Free 30-day trial including 20 SMS!

You may also be interested in other helpful articles:

Discussion on This Article:

  1. matt Says:

    you have some good content! i’m reading this blog since last 4+ months; althoug it is not updated daily like other blog/sites still it makes a good read as it is based upon Linux/UNIX sys admins hard core experince
    considering only 1 or 2 perople contributes to this blog it is a good read and you have Good number of hits as well. Just wanna say good job man & keep it up

  2. Anonymous Says:

    my questions is very simple how do i find out current runlevel as well as last runlevel? since you take linux sys admin class you must have some info :D
    –bha

  3. cyberciti Says:

    > how do i find out current runlevel as well as last runlevel?
    Use who -r command
    $ who -r
    run-level 2 Oct 17 18:21 last=S

  4. cyberciti Says:

    Thanks matt :) We don’t update our blog everyday, as and when event occurs in our life it is get documented here.

    I appreciate your post.

  5. marco Says:

    you have a little typo: Genome

    if the typo is fixed you can delete my comment.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.