[Ubuntu] User management
1 minute read
This post describes a multi user management method that I use in the lab. Since all the users require a root privilege, it is better to have only one group with the root privilege.
Add group
$ sudo groupadd --gid 2000 cglab
Add user
$ sudo useradd [username] -m
$ sudo passwd [username]
$ sudo usermod -a -G docker [username]
Note
-m: Create a home directory.
-a: Add an user to the supplementary group(s).
-G: A list of supplementary groups in which the user is associated.
Add sudo group
Allow the root privilege for those of who are in the group cglab
.
$ sudo visudo
Add following line:
...
cglab ALL=(ALL) ALL
$ sudo usermod -a -G cglab [username]
in user account, type:
$ sudo usermod -g cglab [username]
Note
-g: The group name or number of the user’s new initial login group.
(Optional) Change shell to zsh
Note
Make sure to install zsh and oh-my-zsh first:
$ sudo apt-get install zsh
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
$ sudo vim /etc/passwd
add following at the end of line where [username] is:
...
/bin/zsh