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.
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]
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.)
'Information Technology > Linux' 카테고리의 다른 글
How to install java in Centos7 step by step (0) | 2019.08.13 |
---|---|
How to enable automatically login without private key in AWS EC2 Linux CentOS7 (0) | 2019.08.13 |
댓글