본문 바로가기
Information Technology/Linux

How to grant root authority to specific accounts(Super authority Permission) in Linux CentOS7

by Patrick Moon 2019. 8. 19.

Depending on the server operator's operating policies, this may be necessary, but not recommended!

If you create a subroot account separately and change the existing root account to make it inaccessible, you will have some security against simple server attacks.

 
Now there are a total of three files that need to be modified to work. All of this must be done after first logging in to the root account.

sudo vi /etc/sudoers -- granting sudo permissions
sudo vi /etc/group  -- grant the root group
sudo vi /etc/passwd  -- change uid of root, gid

 

1) sudo vi /etc/sudoers

sudo vi /etc/sudoers

: Modify the file to make the sudo command available.

Insert "specificuser" into /etc/sudoers to modify and add root permission


In this section, enter the following under root ALL = (ALL) ALL.

[Account name] ALL = (ALL) ALL
Once you've done so, you can borrow root with the usual sudo command.

 

 

2) sudo vi /etc/group

sudo vi /etc/group

Next, modify the /etc /group file. Find the root account at the top.

root: x: 0:    <-- You have to find that code via /(some text)
 

Add your account name here. If the account name is user, it will be root: x: 0: user. You can also add other users with commas.

root: x: 0: [account name]

Please refer to the example as above

 

Alternatively, gpasswd -a [account name] [groupname to add] allows you to quickly assign a particular group to the current account without touching the / etc / group file.

Of course, this also changes in /etc/group as above.

 

3) sudo vi /etc/passwd
Finally, modify /etc/passwd.

Find your account name at the bottom, and set both UID and GID to 0 as shown below. (… X: uid: gid :: / home…)

If the username is user it will be user: x: 0: 0 :: / home / user: / bin / bash. (If you don't know, remember or back up your existing UID / GID.)

 

In case of root authority, it marks as above
Find them first, then modify as above accoding to follow the right rule

 

댓글