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

/ bin directory permissions are mistakenly set to 644 solution

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Under the CentOS69 system, in the case of using an ordinary user to log in and switch to the root user, because you want to set the permissions of the bin directory and all files in the / cpu directory to 644, but accidentally set the / bin directory and all files under the directory to 644, resulting in unable to re-log in to the Linux system and can no longer switch.

Now the virtual machine simulates the problem, you can see that in the case of root users, commands such as ls,chmod are prompted to have no permissions.

There are two solutions:

The first method: keep it in the case of the root user who logged in. Enter python at the terminal

Enter: import os at the > prompt that appears

Os.chmod ("/ bin", 0755)

Os.chmod ("/ bin/chmod", 0755)

As shown in the following figure

Press CTRL+D to end the python entry, and you will go back to the prompt

Use the ls command again to view the permissions under the / bin directory, and enter the ls command to also prompt for permission denied

At this point, the permission modification has been completed.

The second method: using rescue simulation

1. Insert the CentOS 6.9 installation CD into the CD drive and set it to boot from the CD drive. Select "Rescue installed system" in the interface shown below

two。 Under the selected language interface, leave the default unchanged and enter directly.

3. In the "Keyboard Type (keyboard type)" interface, keep the default and enter directly.

4. Under the "Setup Networking" interface, choose according to your own needs. Because you modify the permissions, you do not need to use the network. Select "No".

5. Under the "Rescue" interface, select "Continue" and press enter to determine

6. The following two pictures are determined by pressing enter respectively.

7. Select "shell Start shell", select "OK", and press enter to determine.

8. Enter chmod-R 755 / mnt/sysimage/bin/* in the shell of "bash-4.1#".

9. Restart the computer, take out the CD, and set the first boot disk as the local hard disk. Log in using root user again. Can you log in normally and use the command under / bin? no, only run the ls command here.

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