USER AND GROUP ADMINISTRATION -PART- 1 in Linux | useradd,userdel,groupdel,usermod
Topics covered in this videos:
========================
USER AND GROUP ADMINISTRATION (PART- I USER ADMINISTRATION):
Some Important Points related to Users:
1. Users and groups are used to control access to files and resources
2. Users login to the system by supplying their username and password
3. Every file on the system is owned by a user and associated with a group
4. Every process has an owner and group affiliation, and can only access the resources its
owner or group can access.
5. Every user of the system is assigned a unique user ID number ( the UID)
6. Users name and UID are stored in /etc/passwd
7. User’s password is stored in /etc/shadow in encrypted form.
8. Users are assigned a home directory and a program that is run when they login (Usually a shell)
9. Users cannot read, write or execute each other’s files without permission
In Linux there are three types of users:
1. Super user or root user:
Super user or the root user is the most powerful user. He is the administrator user.
2. System user:
System users are the users created by the softwares or applications. For example if we install
Apache it will create a user apache. These kinds of users are known as system users.
3. Normal user:
Normal users are the users created by root user. They are normal users like Rahul, kishore and jaikrith etc.
Only the root user has the permission to create or remove a user.
Whenever a user is created in Linux things created by default:
1. A home directory is created(/home/username)
2. A mail box is created(/var/spool/mail)
3. unique UID & GID are given to user & group
Linux uses UPG (User Private Group) scheme
1. It means that whenever a user is created is has its own private group
2. For Example if a user is created with the name Rahul, then a primary group for that user will
be Rahul only.
There are two important files a user administrator should be aware of
1. “/etc/passwd”
2. “/etc/shadow”
LAB WORK:
Creating a user:
• The syntax for creating a user in Linux is
# useradd option username
Options are:
• -u user id
• -G Secondary group id
• -g primary group id
• -d home directory
• -c comment
• -s shell
Let’s create a user with default attributes:
1. When no option is used with useradd command the options like UID, GID, home dir and shell will be assigned default.
#useradd username
#useradd ktusr
Observe that the uid, gid, home dir, and shell is assigned automatically.
Let’s create a user with our own attributes:
• Create a user with following attributes
• Name = ktuser2
• uid=505
• gid=505
• home dir = /home/kernel
• comment =salesman
#useradd ktuser2 –u 505 –d /home/kernel –c salesman
Assigning password to the user:
• As a root user we can assign any password to any user
• The syntax for assigning a password is
• #passwd to assign password to current user ( the one with which you have logged in, if it is
root then root’s password will be changed)
• #passwd user name to assign a password to a specific user, only root can assign
password to other user.
Modifying the user’s attribute:
• After creating a user if we need to modify the attributes of user like changing uid, changing
secondary group id or adding a comment, locking or unlocking the user account, can be done by following command.
• Syntax. # usermod options username
Options:
• all the options which are used with useradd command can be used and also the following,
• -l to change login name
• -L to LOCK account
• -U to UNLOCK account
ex:- # usermod -l newname oldname (changing the name of the user)
ex:- # usermod -L newname to lock the user account
ex:- # usermod -U newname to unlock the user account
Note: – when an account is locked it will show! (Exclamation mark) in /etc/shadow file
Locking and unlocking a user account:
• To lock a user a/c use the following
#usermod –L user name
#usermod –L ktuser2
• Verify it in /etc/shadow file, it shows exclamation mark before user a/c or try login as ktuser2
Unlocking a user a/c:
• Unlock the above a/c
#usermod –U user name
#usermod –U ktuser2
• Verify it in /etc/shadow file, it shows exclamation mark before user a/c or try login as ktuser2
• To view the advanced parameters of the user, use
#chage -l user name
#chage -l ktusr
Changing the password parameters:
• Changing of the password parameters can be done by two ways.
#chage user name
#chage option value username
#chage ktusr
Deleting a User:
• To delete a user the syntax used is
#userdel username it will only delete the user but home directory will be there.
• To delete the user with its home directory use the following command.
#userdel –r user name
#userdel –r ktuser2
#UserPasswordSecurity
#UserAttributeModification
#AccountLockUnlock
#PasswordParameters
#UserAccountDeletion
#arntechtrainings
user account management best practices,privileged account management best step,#ARNTechTrainings,useradd,passwd,userdel,groupdel,usermod,chage,unique user ID,group ID
by ARN Tech Trainings
linux ftp server
Nice explanation sir when wil u start next topic sir