4.20.2015

Creating Linux users and gropus

Commands are typed and executed in a shell terminal. When a terminal is opened, a prompt is available which usually has the following format:
username@hostname$

Or:

root@hostname #

or simply as $ or #.

$ represents regular users and # represents the administrative user root. Root is the most privileged user in a Linux system.


Effected Files:

/etc/passwd,
 /etc/shadow,
/etc/group
/etc/gshadow


We can create groups in a way to group users before or after creating users.

Adding/modifying groups:

groupadd
groupmod
gpasswd
groupdel

Switches -a  : to add users
               -d : to delete users
               -m : to add multiple users

Eg :

#groups - displays group of user


Adding/modifying users:

Switches -a  : to add users
               -d : to delete users
               -m : to add multiple users


useradd
usermod
passwd
userdel
chage

Eg:

#useradd


  1. Username: User login name used to login into system. It should be between 1 to 32 charcters long.
  2. Password: User password (or x character) stored in /etc/shadow file in encrypted format.
  3. User ID (UID): Every user must have a User ID (UID) User Identification Number. By default UID 0 is reserved for root user and UID’s ranging from 1-99 are reserved for other predefined accounts. Further UID’s ranging from 100-999 are reserved for system accounts and groups.
  4. Group ID (GID): The primary Group ID (GID) Group Identification Number stored in /etc/group file.
  5. User Info: This field is optional and allow you to define extra information about the user. For example, user full name. This field is filled by ‘finger’ command.
  6. Home Directory: The absolute location of user’s home directory.
  7. Shell: The absolute location of a user’s shell i.e. /bin/bash.