Create a new user
-m #为创建账号主目录,默认不创建
-r #为创建系统管理员账号
-s /bin/bash #使用bash作为默认的shell环境
-G #Add to group
useradd -mr -s /bin/bash -G dev account
passwd account #添加密码
If you want to set it as sudo
adduser account sudo #将用户加入sudo组
groups account #参看用户的组
Modify the group of an exist account
In this example, change tony user’s primary group to www, enter:
# usermod -g www tony
Add existing user tony to ftp supplementary/secondary group with the usermod command using the -a option ~ i.e. add the user to the supplemental group(s). Use only with -G option:
# usermod -a -G ftp tony
usermod command options summary
Option Purpose
-a
–append Add the user to the supplementary group(s). Use only with the -G option.
-g GROUP
–gid GROUP Use this GROUP as the default group.
-G GRP1,GRP2
–groups GRP1,GRP2 Add the user to GRP1,GRP2 secondary group.