Linux ordinary users permission to modify

The permission to modify the blog about everywhere, but this article is mainly for configuration files modified after ordinary users still can not create a file operation performed.

Modify the permissions, primarily to modify / etc / sudoers below

1. to root

command:

his

2. Add the write permission to root sudoers file

command:

chmod 777 /etc/sudoers

3. Edit the sudoers file

command:

vi /etc/sudoers

Find the line

root ALL=(ALL) ALL

In the following add

username ALL=(ALL) ALL

May be added to any of the following four formats

youuser            ALL=(ALL)                ALL

%youuser          ALL=(ALL)                ALL

youuser            ALL=(ALL)                NOPASSWD: ALL

%youuser          ALL=(ALL)                NOPASSWD: ALL

The first line: allows the user to execute youuser sudo command (password required).

The second line: allows the user to perform user group youuser inside sudo command (password required).

Third row: youuser allows users to run sudo command, and do not enter the password in the course of implementation.

Fourth row: which allows the user to group youuser sudo command performed by the user, and do not enter a password at the time of execution.

Exit the command:

ESC +:wq

4. Undo sudoers file permissions

command:

chmod u-w /etc/sudoers

After modifying, if you encounter the following problems

Blog source address :( I had with this configuration did not come out, estimated to be their configuration problem. So I found a second method)

https://blog.csdn.net/qq_38333529/article/details/79608224

Linux: sudo, no valid sudoers resources.

The source of this blog address is:

https://blog.csdn.net/llh_1178/article/details/58606179

First find the cause. Here it is mainly ordinary users enough authority. The above configuration steps should be a problem. So, do not worry
There are the following methods.
Use ls -l / etc / passwd to see all users and permissions. Only read permission (r), the user's rights not be described.
Therefore, we can modify the user permissions in the following ways:
     1. su root # super-user access
     2. ll / etc / sudoers # View / etc / sudoers permissions
     3. chmod 777 / etc / sudoers # modify / etc / sudoers file permissions to read-write executables
     4. echo 'username ALL = (ALL) ALL' >> / etc / sudoers # 'username' refers to the user name, the user name to specify permissions
     5. chmod 440 / etc / sudoers # exit Save / etc / sudoers file
     6. su username # switch user to a specific user
Finally, when performing various commands like installation or download, use sudo add instruction on the list.

Guess you like

Origin www.cnblogs.com/littleswan/p/12055825.html