After learning the CentOS system for a long time, we have learned more about it. Here, we mainly learn how to enable (or restart) The server host when the CentOS system is in a normal state, the system pilot program can automatically boot the Linux system to multi-user mode and provide normal network services. If the system administrator needs to perform system maintenance or a startup exception occurs, the system needs to be managed in single-user or repair mode.
One premise of using the single-user mode is that your system Boot Tool (grub) works normally. Otherwise, you must use the repair mode for system maintenance. Note: In single-user mode, network service is not enabled and remote connection is not supported.
Different Run levels in the CentOS system indicate different running states of the system. For example, if the Linux server is in the running Level 3 during normal running, it is a multi-user mode that can provide network services; the running level 1 only allows administrators to operate on the server host through a single console, that is, "single user mode ".
Take CentOS as an example:
CentOS system enters Single User Mode
The premise of entering the single-user mode is that the CentOS System Boot Tool works properly. The following uses GRUB as an example to describe the access method. There are three operation buttons "a", "e", and "c" in the GRUB boot menu. You can use these buttons to enter the single-user mode.
Use the "a" operation button to enter single-user mode-recommended: simple operation
This is the fastest way for CentOS to enter the single-user mode. Use the "a" operation button in the GRUB Startup menu to edit the kernel Parameter and enter single at the end of the line to inform the Linux kernel that the subsequent startup process needs to enter the single user mode. Press enter.
After entering the single-user mode
When the CentOS system enters the single-user mode, you do not need to enter the user name and password. After the CentOS system is started, the administrator root permission is directly obtained. The console prompt is "#".
Console interface in Single User Mode
The preceding startup information is critical: Remounting root filesystem in read-write mode: [OK] indicates that the root file CentOS in single-user mode is readable and writable. The CentOS system administrator can maintain the system only when the root file system is readable and writable. If the system configuration and script file are incorrect, the root file system in single-user mode enters the read-only file system read-only status, run the following command to re-mount the root file system in read/write mode:
Sh-3.1 # mount-o remount rw-t ext3/
When the CentOS system enters the single-user mode, no one else (through the network) will stop any network service or network configuration (the network interface is invalid) it interferes with the running status of the CentOS system. administrators can safely perform system-level maintenance on the CentOS system. In single-user mode, CentOS is a fully functional operating system except for its network functions. In single-user mode, you can perform the following maintenance and management tasks:
Reset the superuser password
Maintains CentOS system partitions, LVM, and file systems.
Back up and restore the CentOS System
A typical application of single-user mode is the "password setting" of the root user ". For CentOS systems that are temporarily used or used for experiments (such as student labs), users are often changed, and the root user's password may be lost, in this case, you can change the password of the root user in single-user mode.
Sh-3.1 # passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
Passwd: all authentication tokens updated successfully. after the CentOS system enters the single-user mode, run the passwd command at the "#" prompt to update the password of the root user, after the CentOS system is restarted, you can use the updated password to log on to the system as root.