Adding users and groups
From Linux 101, The beginner's guide to all things Linux.
Adding users and groups is easy.
[edit] Users
To add a user, use the following commands:
- #
useradd newusername - #
passwd newusername
Optionally, you can set additional user info and the default shell using the following commands:
- #
chfn newusername - #
chsh newusername
|
Note: Although our examples here show root running these previous two commands, it is possible for a user to switch his/her finger information and shell choice for himself/herself by running these commands, if the system is set up to allow it. |
[edit] Groups
Adding groups is similar:
- #
groupadd newgroupname
Users can be added to groups using this command:
- #
gpasswd -a username newgroupname
A password can also be set for a group, which will allow anyone who knows it to join the group later:
- #
gpasswd newgroupname

