Linux 下如何添加一个普通用户,并给予用户root权限
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
1.添加用户,首先用adduser命令添加一个普通用户,命令如下
adduser test1 //添加一个名为tommy的用户
passwd test1 //修改密码
Changing password for user test1.
New UNIX password: //在这里输入新密码
Retype new UNIX password: //再次输入新密码
passwd: all authentication tokens updated successfully.
2、赋予root权限
修改/etc/sudoers权限
chmod u+w /etc/sudoers
修改/etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
test1 ALL=(ALL) ALL
修改完成要把/etc/sudoers权限改回来
chmod u-w /etc/sudoers
注意一定不能修改为777权限,权限太高导致sudo不能使用
修改完毕,现在可以用test1帐号登录
3.查看所有的用户
cat /etc/passwd
4.删除用户
userdel -r test1




A beautiful web dashboard for Linux
最近提交(Master分支:5 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
所有评论(0)