Life span of a Linux user/ basic Linux user management

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.

User creation

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
Cat /etc/group | grep engineering
Cat /etc/group | grep eng && cat /etc/group | grep newcomer
  • Check if the shell, requested by Bob exists by doing cat /etc/shell, if not present install it, to make the user happy.

    sudo yum install ksh
    sudo yum install ksh

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

    User bob exists and is enjoying his korn shell
    User bob exists and is enjoying his korn shell
  • from cat /etc/passwd| grep bob, where all the information will be gathered in a single row.
cat /etc/passwd | grep Bob
cat /etc/passwd | grep Bob