USER AND GROUP ID

When files are stored on the computer the data about the file is stored numerically.

This is the data doesn't contain the user name and group of a file. The user name are mapped to UID number & group names are mapped to GID.

The authentication information of users are store in the following plain text

  • /etc/passwd
  • /etc/shadow
  • /etc/group
  • /etc/gshadow

When a user runs ls -l command, the numeric information is translated into names, it is the names are displayed. The mapping no's to the names are stored in the files ;

  • /etc/passwd
  • /etc/group

The etc passwd file contains the following fields -

1. User name
2. Password
3. UID number
4. GID number
5. User's real name
6. home directory
7. shell to be used to him a user logs in

USER MANAGEMENT TOOLS

Their are two ways to manage user accounts in Linux. One is graphically other way is through the command line. You could also directly after the configuration file.

The GUI tool for managing users and groups is system configuration users and groups is system configure user, which is access through the users and groups of the system administrative menu.

Image Source : Google
User Manager Window

You can notice that the window has two tabs, one for managing groups and other for managing users.

To add a user click on the add user icon. This will open the another window.

Image Source : Google
Create new user Window


ADD OR DELETE USER

From the command line you can create many users. The useradd and userdel commands are used for adding new users and deleting existing users.

The useradd command create a new user on updates new users default information.

for example- 

$ useradd username

Hypen G (-g) can be use to set the group for the new user.

for example -

$ useradd user1 -g staff

-s option can be used to set the shell for the new user as follows -

$ useradd user1 -s /bin/bash

The user del command delete an existing user accounts. 

For example 

Delete the user a/c for the user1

$ userdel user1

When you remove a user a/c form your system the files & directories of this user still remain on the system. To also remove them you can use -r with userdel command.

$ userdel -r user


DEFAULT PERMISSIONS


The default permissions for a newly created file is 666. This means that anyone on the system will have read and write permission to any newly created file and similarly full permissions to any directories.

In order to restrict permissions one can use a umask the user file creation mode mask is use to determine the file permission for newly created file.

It can be used to control. The default file permission for new file. It is a three octal number.

for example -


$ umask 044


Your feedback is very important for us :)