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

Add user login function to the root file system

2025-04-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1: why is there no user login interface when rebooting the file system?

In the file inittab, when:: respawn:-/bin/sh is executed, it goes directly to the command line, so the user login interface is not displayed, so adding the user login interface needs to be done here.

How to realize user login by 2:busybox

We know that busybox is a collection of many executable programs, and busybox also integrates user login commands, which are / bin/login and / sbin/gettty.

3: add user login interface

Combined with the above, just change:: respawn:-/bin/sh to:: respawn:-/bin/login or:: respawn:-/sbin/getty.

4: further improvement

Reloading the file system can find that the system has a user login interface, but can not log in, because we call the user login program when the system starts by modifying the inittab file, but we do not set the user name and user password.

In linux, the user name is managed by the / etc/passwd file, and the user password is managed by etc/shadow. The format of these two files can be self-Baidu, which will not be described here. So we just need to copy the / etc/passwd and / etc/shadow files in ubuntu to the / etc directory in the root file system, and of course we need to modify the format accordingly.

There are only root users in busybox, so you can delete the information of ordinary users in passwd. At the same time, you have to modify the directory entered by root users when logging in. At the same time, delete the login password of the corresponding root users in shadow. The password of root users can be modified using passwd root after login.

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

Servers

Wechat

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

12
Report