在 ubuntu 服务器上添加一个用户,并赋予权限。
文章目录
新建用户权限管理新建用户
Add a new user (test
is the user name). We often use the second command. Use-r
to create a system account,-m
to create the user’s home directory,-s
to specify the login shell of the new account. You can use check file/etc/passwd
to verify.
useradd testsudo useradd -r -m -s /bin/bash test
Set password for the user
passwd test
Delete this user
userdel test
权限管理
To usesudo -i
. First, use commandsudo chmod +w /etc/sudoers
to change the property of the file. Then addyour_account_nameALL=(ALL:ALL) ALL
, thensudo chmod -w /etc/sudoers
reover. see
Ubuntu 18.04下创建新用户/目录、修改用户权限及删除用户的方法 - 云外博客 | 步入云端探索未知奥秘
If you want to add your new account to the sudo (Super User do) group.
sudo usermod -a -G sudo liyp
But this is unnecessary, so use the command to remove it.
gpasswd -d username groupname
Add user into sudo
Remove user out of group
[root@localhost ~]#分别代来表:
1、用户名:root
2、主机名:localhost
3、当前路径:~当前用户的home目录
4、权限源标志位:# or $
Another link, I find that it contains all the contents above.
Ubuntu 18.04下创建新用户/目录、修改用户权限及删除用户的方法 - 云外博客
如果觉得《Ubuntu 新建用户并赋予权限》对你有帮助,请点赞、收藏,并留下你的观点哦!