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 usernameBe 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 usernameA 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 usernameThat'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用户