Home  >  Article  >  Operation and Maintenance  >  Three solutions to the problem that the sudoers folder permissions of the Linux system are 777 and the /etc/profile file cannot enter the system after modification

Three solutions to the problem that the sudoers folder permissions of the Linux system are 777 and the /etc/profile file cannot enter the system after modification

坏嘻嘻
坏嘻嘻Original
2018-09-15 15:33:456317browse

This article brings you three solutions to the problem of the sudoers folder permissions 777 in the Linux system and the inability to enter the system after the /etc/profile file is modified. It has certain reference value. Friends in need can For reference, I hope it will be helpful to you.

First of all, let’s talk about the method to restore the sudoers folder to 0440:

Method 1 (modify directly in the graphical interface):
①Enter Terminal, switch to administrator status, and enter su.
② Enter chmod 0440 /etc/sudoers. No information is printed, indicating that the modification is successful (try the sudo command to see if it still prompts 777);
If the prompt README is 777, after changing the README path to 0440, you can use the sudo command.

Method 2 (modify in the command interface):
①First press the alt ctrl F1 key on the keyboard to switch to the command interface.
② Switch to administrator status and enter su.
③Enter chmod 0440 /etc/sudoers. No information is printed, indicating that the modification is successful (try the sudo command to see if it still prompts 777);
If the prompt README is 777, after changing the README path to 0440, you can use the sudo command.
④Press alt ctrl F7 on the keyboard to switch back to the graphical interface.

Method three (without administrator identity modification):
pkexec chmod 0440 /etc/sudoers (execute command as administrator).
——————————————————————————————

Let’s talk about the /etc/profile file that cannot be modified after modification. Enter system recovery method:
①First press the alt ctrl F1 key on the keyboard to switch to the command interface.
②Switch to administrator status and enter su.
If you do not successfully switch to the administrator identity, you need to set a login password:
​ ​ 1. Enter the sudo passwd command and set the login password (here you can set it as the password used to log in to the system);
​ ​ 2. Enter su.
③Enter cd /etc to enter the etc folder;
④Use vim to edit profile file:
Enter vi profile, find the information accidentally written (or accidentally deleted) in the profile file, restore it, save and exit;
You can enter the system after restarting the system (Note: The vim file operation method is a bit troublesome, you can search on Baidu for the operation method).

The above is the detailed content of Three solutions to the problem that the sudoers folder permissions of the Linux system are 777 and the /etc/profile file cannot enter the system after modification. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn