Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enter single-user mode under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to enter single-user mode in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The probability of forgetting the root password is very high, but it is also very simple to solve this problem under linux. You only need to restart the linux system, and then boot into linux's single-user mode (init1). Because the single-user mode does not need to enter the login password, you can directly log in to the system and change the root password to solve the problem.

1. Pause the startup process

First of all, you need to have the console of the machine to enter single-user mode. If it is a virtual machine, it is the virtual machine console, if it is a physical machine, then you need to connect to its iLO/ serial port console. Restart the system and press any key in the GRUB boot menu to stop the automatic startup of the kernel.

Techniques for entering single-user mode in Linux 2. Edit kernel startup options

After entering the above page, press e on the selected kernel (usually your preferred latest kernel) to update its startup options. You will see the following page.

Skills of entering single-user mode in Linux skills of entering single-user mode in Linux

Now, scroll down to the kernel boot line and add init=/bin/bash at the end of the line, as shown below.

Skills of entering single-user mode in Linux skills of entering single-user mode in Linux 3. Kernel after boot and editing

Now press Ctrl-x or F10 to start the edited kernel. The kernel will start in single-user mode, and you will see the # prompt, which means you have root access to the server. At this point, the root file system is mounted in read-only mode. Therefore, any changes you make to the system will not be saved.

Run the following command to remount the root file system as rewritable.

Kerneltalks:/ # mount-o remount,rw /

It's done! Continue to do what you need to do in single-user mode. Don't forget to restart the server to boot to normal multi-user mode when you are finished.

Thank you for reading! This is the end of the article on "how to enter single-user mode under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report