2022/07/05

CentOS 建立有root權限的帳號

 因為不想讓其他人有root的密碼,但又需要root權限工作,所以需要建立一個有root權限的帳號。

帳號建好後,執行下列指令,讓該帳號能用sudo,又不需要輸入任何root密碼,就可用root權限工作。做完在把該帳號停用就好了。

[root@test ~]# visudo

在裡面找到下列這行

root    ALL=(ALL)       ALL

在底下加入其他用戶

newuser     ALL=(root) ALL  

存檔離開,然後newuser就可以在不輸入密碼的情況下執行sudo指令,達到有root權限的目的。


Creating a Root-privileged Account on CentOS

To prevent sharing the root password with others while still needing root privileges, it is necessary to create an account with root privileges.

Once the account is created, execute the following command to allow the account to use sudo without entering any root password, enabling it to perform tasks with root privileges. Afterward, the account can be deactivated.

[root@test ~]# visudo

Find the following line within the file:

root ALL=(ALL) ALL

Add the desired user below it:

newuser ALL=(root) ALL

Save the changes, exit the file, and then the newuser can execute sudo commands without entering a password, achieving the goal of having root privileges.


沒有留言:

張貼留言