User under linux, group management

Add user

useradd user1   //创建用户user1
ls –l /home  //查看home下有了user1文件夹
passwd user1  //添加密码
tail  /etc/passwd  //查看最后多了一行user1开头的
su - user1  //切换到user1
su - root //输入root密码切回root

verify:

sudo -l -U user1

Authorization:

root ALL=(ALL) ALL
user1 ALL=(ALL) NOPASSWD:ALL #给user1授权操作权限

Sometimes you will encounter '/etc/sudoers' is read only

Switch to root and enter the visudo command

After adding user1 ALL=(ALL) NOPASSWD:ALL

Then ctrl + x to exit, whether to save, select yes, and then press Enter to exit

Reference: Ubuntu creates new users and authorizes_2241431065's blog-CSDN blog_ubuntu creates users and grants permissions

Guess you like

Origin blog.csdn.net/cxs812760493/article/details/127734522