Bob comes into the company and wants to use Linux as his main Operating system.
Some of the basic moments in the lifespan of his user on Linux are: user creation, group adding, SELinux user related activities, deletion, etc.
Useradd -g newcomer -G engineering -s ksh -m -k Bob
It’s good to make few checks before issuing the command:
- Check if the groups exist, could be done by grepping the /etc/group file, as shown below. If group doesn’t exist, they are easy to create: groupadd engineering && groupadd newcomers
- Check if the shell, requested by Bob exists by doing cat /etc/shell, if not present install it, to make the user happy.
And this command will make the user Bob, add him in the group newcomers and to the supplemental group engineering, will specify his shell to his preferable ksh and will make him a home folder with the skeleton files.
- Check if the user is created and that he is in the appropriate groups
- from the user himself
- from cat /etc/passwd| grep bob, where all the information will be gathered in a single row.