linux創建sudo用戶
sudo
stands for either "superuser do" or "switch user do", and sudo
users can execute commands with root/administrative permissions, even malicious ones. Be careful who you grant sudo
permissions to – you are quite literally handing them the key your house.
sudo
代表“超級用戶”或“切換用戶”,并且sudo
用戶可以執行具有root /管理權限的命令,甚至是惡意的。 請小心,向誰授予sudo
權限-實際上是在將密鑰交給您的房子。
Before creating a new sudo
user, you must first create a new user.
在創建新的sudo
用戶之前,您必須首先創建一個新用戶。
如何創建新用戶 (How to Create a New User)
使用adduser
或useradd
添加新用戶 (Use adduser
or useradd
to add a new user)
sudo adduser username
Be sure to replace username
with the user that you want to create. Also, note that to create a new user, you must also be a sudo
user yourself.
確保將username
替換為您要創建的用戶。 另外,請注意,要創建新用戶,您自己還必須是sudo
用戶。
使用passwd
更新新用戶的密碼 (Use passwd
to update the new user's password)
sudo passwd username
A strong password is highly recommended!
強烈建議您使用強密碼!
授予新用戶Sudo權限 (Give the New User Sudo Permissions)
After creating a new user, add them to the appropriate group using the usermod
command.
創建新用戶后,使用usermod
命令將其添加到適當的組。
在Debian系統(Ubuntu / Linux Mint / ElementryOS)上,將用戶添加到sudo
組 (On Debian systems (Ubuntu / Linux Mint / ElementryOS), add users to the sudo
group)
sudo usermod -aG sudo username
在基于RHEL的系統(Fedora / CentOS)上,將用戶添加到wheel
組 (On RHEL based systems (Fedora / CentOS), add users to the wheel
group)
sudo usermod -aG wheel username
如何刪除用戶 (How to Delete a User)
To delete a user, use the following commands.
要刪除用戶,請使用以下命令。
基于Debian的系統(Ubuntu / Linux Mint / ElementryOS) (Debian based systems (Ubuntu / Linux Mint / ElementryOS))
sudo deluser username
基于RHEL的系統(Fedora / CentOS) (RHEL based systems (Fedora / CentOS))
sudo userdel username
That's all you need to know about creating a new sudo
user in Linux. And remember, "With great power comes great responsibility."
這就是在Linux中創建新的sudo
用戶所需的全部知識。 記住,“能力越強,責任就越大”。
翻譯自: https://www.freecodecamp.org/news/the-ultimate-guide-to-linux-creating-a-sudo-user/
linux創建sudo用戶