Use Linux init to control six login Modes

Source: Internet
Author: User

Init is the root process in Linux and the ancestor of all processes in the system. It is mainly used to generate processes based on a script recorded in/etc/inittab. This file is usually used to control the user logon mode. Valid logon modes for Linux are 0 ~ There are a total of 10 types, but the limits of up to 6 types of UNIX systems are used, generally only 1 to 6 are valid.

Init generally runs automatically when the system starts. It can also be called by the root user. It is used to switch the running status of the system. The command format is init NUM <press enter>. NUM indicates any number from 1 to 6.

Two of the six modes are determined by the system:

0: Stop the system. Init 0 <press enter> is equivalent to halt <press enter> 〉.

6. restart the system. Init 6 <press enter> is equivalent to reboot <press enter> 〉.

If you know the/etc/inittab file, do not set 0 to the default logon mode. Otherwise, your Linux operating system will only have 2.1 lines-boot success → shutdown, or an infinite loop of reboot → restart. The other four modes are determined by the operating system. If you are willing to modify the source code of Linux, you can also define the actual functions of these 4 or 6 modes. In fact, it is enough to know the conventions of the Linux release vendor. Let's take the blue point 2.0 as an example to see the common conventions of init --

Init 1 -- enter single-user mode. This is the same as choosing Safe Mode when starting the system. You can manage the system with root permissions, but cannot enter the graphic Mode or Chinese characters, sound cards and network services are not required. In short, it is the minimum software and hardware configuration that the system can run. It is similar to the Windows security mode, but the essential difference is that as long as you run the corresponding commands in Linux, hardware devices can be driven in this mode. For example, if you only need the correct connection between your optical drive and a mount/dev/cdrom command, the content of your optical drive can be read from/mnt/cdrom at any time. Note that the character console in this mode cannot support Chinese characters, but you can still see the beautiful Chinese font on the blue dot in Xwin mode, and the input method is completely correct.

Init 2 -- enter the multi-user mode without network services. If your computer has no network connection, this mode will be the same as the normal mode. Otherwise, others will not be able to log on to your computer through the network www, ftp or telnet, but will still respond to the ping command on your computer. If the ping command is rejected, we recommend that you unplug the network cable! If your computer acts as a network server, this mode will be quite useful. For example, if you want to refresh the system or update the website content, you can adjust the computer to this mode and perform your work with confidence, after the work is completed, switch to Mode 3 or 5. However, if a user has already logged on to your system through ftp or telnet, using init 2 won't interrupt the connection between the user and you. Please be careful when someone else gets away with you! -- Run the who command before executing init 2. In this mode, the usage on the local machine remains unchanged. You can still access the network, the Internet, ftp, or telnet to any server in the network. Your computer does not provide services to other machines on the network. When the computer is transferred from 3rd running level to this mode, you will see a series of network services stopped.

Init 3 or init 4 -- logon to the console in multi-user mode. This is the default logon mode of blue point 1.0, every user must log on from the black and white screens before they can run startx to enter the KDE world. After Xwin is started, the console that runs startx will be locked, unless you use startx & to run Xwin in the background. To go to another console, use Ctrl + Alt + F * to indicate any one of the numbers 1 to 6, ctrl + Alt + F7 then return to the graphics mode dedicated 7 console sometimes use Ctrl + Alt + F8 ). If you switch from init 1 or init 2 back to init 3, we can see that a series of services are restarted.

Init 5 -- enter the multi-user mode for graphical login. This is the default startup mode after Blue Point 2.0 is installed. After the system starts or runs the init 5 command, a beautiful logon window appears on the blue-green transition background. All account names are displayed in the window as icons, so you do not have to enter them yourself. However, the system administrator may be unhappy-isn't it clear how many users in the system? However, modification in the KDE control center can solve the problem. If a problem occurs in the system, as long as the system can still enter this interface, it indicates that there is no problem with the X server), the root account can also enter the Linux security mode from here, in the lower-left selection box, change the mode from kde to save failed. Of course, the interface is definitely not beautiful, but it is essential to fix the problems of the X Window Manager or application.

When the login window appears, the console from 1 to 6 is often locked. However, after a user successfully or fails to log on to the console, the console from 1 to 6 becomes available. Is it a bit confusing? Sometimes you have to press a few more keys or even Ctrl + C after switching. Now let's solve the second problem mentioned at the beginning of the article-there are two methods: the traditional method is to run the setup command as root and reconfigure the X Window System, specify that the next time the system starts, it will not automatically enter the graphics mode. Another method is to go to one of the 1 to 6 in the console, type init 3 <press enter> 〉, the graphical logon window disappears from the console 7, and any user can log on to the system using startx.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.