SlideShare a Scribd company logo
1 of 4
Download to read offline
Create-Modify-Delete-users-in-Linux-Unix
One of the day to day activity for any Linux/UNIX admin is to create new user and modify
their attributes as per the end user requirements.
Below is the list of Linux commands that we use for user administration.
useradd ---- For adding a new user
usermod---- For modifying user attributes
userdel------ For removing user from Linux machine.
We focus here on useradd command with examples for adding a user in linux.
Note:
For add/modify/remove users, we should have root level privileges or someone having sudo
root user credentials.
A non-root user, should raise request or ticket following ITIL standards, for any changes in
user credentials on the machine.
Create a new user:
In general, Non root users won't have credentails to create a new user. Instead they have to
request the Linux team following ITIL standards to create a new user.
Command Syntax:
Below given are some of the most commonly used options with useradd commands. for more
options, please refer to man pages or info of command.
#useradd u -g -G -c -d <user’s working directory> -m –s
Options:
g--------Primary group
G------ Secondary group
C------- Comment at type of user
m------make directory
s--------Shell
d--------Path of user’s home directory.
Note:
u -----user id’s in RHEL 6 0- 499 are reserved
0-99 are system users
100-499 are daemon users
500-2147483647 are minimum user id and maximum user ids available to be assigned by
linux administrators.
For example,
Create a new user named "john" for database admin team, assigning Bash shell.
Before creating any new user, we should gather few details from end user,
Userid =501
Primary group = dba
Secondry group = sales
Comment = system admin
Directory = /home/john
Shell=/bin/bash
Username = john
Syntax
[root@sys2 ~]# useradd -u 501 -g dba -G sales -c systemadmin -d /home/john -m -s /bin/bash john
Note:
∑ username & user id both are not same. username is generic name for human understanding,
whereas userid is unique number assigned to each user by OS for its reference.
∑ In Linux, we can create usernames with capital letters also, but best practice is to follow
lower cases.
To check whether a user is created or not, we can use any one of the below ways,
∑ Using "id" command,
[root@sys1 ~]# id john
uid=501(john) gid=501(john) groups=501(john)
∑ Checking from /etc/passwd file,
[root@sys2 ~]# grep john /etc/passwd
john:x:501:502:systemadmin:/home/john:/bin/bash
Note:
∑ usernames are case sensitive in Linux and UNIX Flavors. Type, id JOHN and see the output.
∑ If the group doesn’t exist already, then they are created by default with the user name.
Default attributes for new user:
The default attributes for a normal user are user id and group id given by the system.
Default working directory is ‘/home/’
The default shell is bash shell.
For example,
Creating a user in linux machine with default attributes.
The syntax is, #useradd <sampleusername>
[root@sys2 ~]# useradd steve
Checking the details in /etc/passwd file,
[root@sys2 ~]# grep steve /etc/passwd
[root@sys2 ~]# grep steve /etc/passwd
steve:x:503:503::/home/steve:/bin/bash
Topic review through questions:
1. How to create a new user in Linux machine?
2. what is the userid value of a user? detail about reserved userid values?
3. Can we have a username in capital letters in Linux machine?
4. Where does the default attributes of a user stored?

More Related Content

Viewers also liked

экстренная имунопрфилактика столбняка
экстренная имунопрфилактика столбнякаэкстренная имунопрфилактика столбняка
экстренная имунопрфилактика столбнякаSlava Kolomak
 
Uso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, Colombia
Uso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, ColombiaUso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, Colombia
Uso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, ColombiaJosé Vitelio Pineda Monge
 
Diario Oficial 07.02.2017 Reglamento Categoría Municipios y Alcaldes
Diario Oficial 07.02.2017 Reglamento Categoría Municipios y AlcaldesDiario Oficial 07.02.2017 Reglamento Categoría Municipios y Alcaldes
Diario Oficial 07.02.2017 Reglamento Categoría Municipios y AlcaldesNelson Leiva®
 
Alta frecuencia
Alta frecuenciaAlta frecuencia
Alta frecuenciahannia7
 
PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)
PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)
PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)MULTINIVELES
 
Class Presentation slides 05092016 vF
Class Presentation slides 05092016 vFClass Presentation slides 05092016 vF
Class Presentation slides 05092016 vFDing Ma
 

Viewers also liked (10)

Organigramas
OrganigramasOrganigramas
Organigramas
 
экстренная имунопрфилактика столбняка
экстренная имунопрфилактика столбнякаэкстренная имунопрфилактика столбняка
экстренная имунопрфилактика столбняка
 
Uso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, Colombia
Uso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, ColombiaUso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, Colombia
Uso de plantas aromáticas y medicinales en áreas de La Cocha, Nariño, Colombia
 
Diario Oficial 07.02.2017 Reglamento Categoría Municipios y Alcaldes
Diario Oficial 07.02.2017 Reglamento Categoría Municipios y AlcaldesDiario Oficial 07.02.2017 Reglamento Categoría Municipios y Alcaldes
Diario Oficial 07.02.2017 Reglamento Categoría Municipios y Alcaldes
 
Alta frecuencia
Alta frecuenciaAlta frecuencia
Alta frecuencia
 
PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)
PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)
PRESENTACION RED AMIGO SIN KIT DE INICIO (DESDE MARZO)
 
Revista caro1
Revista caro1Revista caro1
Revista caro1
 
Class Presentation slides 05092016 vF
Class Presentation slides 05092016 vFClass Presentation slides 05092016 vF
Class Presentation slides 05092016 vF
 
Resume[1] (2)
Resume[1] (2)Resume[1] (2)
Resume[1] (2)
 
TOR - CAV
TOR - CAVTOR - CAV
TOR - CAV
 

Recently uploaded

MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroomSamsung Business USA
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfChristalin Nelson
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 

Recently uploaded (20)

MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdf
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 

Create-Modify-Delete-users-in-Linux-Unix

  • 1. Create-Modify-Delete-users-in-Linux-Unix One of the day to day activity for any Linux/UNIX admin is to create new user and modify their attributes as per the end user requirements. Below is the list of Linux commands that we use for user administration. useradd ---- For adding a new user usermod---- For modifying user attributes userdel------ For removing user from Linux machine. We focus here on useradd command with examples for adding a user in linux. Note: For add/modify/remove users, we should have root level privileges or someone having sudo root user credentials. A non-root user, should raise request or ticket following ITIL standards, for any changes in user credentials on the machine. Create a new user: In general, Non root users won't have credentails to create a new user. Instead they have to request the Linux team following ITIL standards to create a new user. Command Syntax: Below given are some of the most commonly used options with useradd commands. for more options, please refer to man pages or info of command. #useradd u -g -G -c -d <user’s working directory> -m –s Options: g--------Primary group G------ Secondary group C------- Comment at type of user m------make directory s--------Shell d--------Path of user’s home directory.
  • 2. Note: u -----user id’s in RHEL 6 0- 499 are reserved 0-99 are system users 100-499 are daemon users 500-2147483647 are minimum user id and maximum user ids available to be assigned by linux administrators. For example, Create a new user named "john" for database admin team, assigning Bash shell. Before creating any new user, we should gather few details from end user, Userid =501 Primary group = dba Secondry group = sales Comment = system admin Directory = /home/john Shell=/bin/bash Username = john Syntax [root@sys2 ~]# useradd -u 501 -g dba -G sales -c systemadmin -d /home/john -m -s /bin/bash john Note: ∑ username & user id both are not same. username is generic name for human understanding, whereas userid is unique number assigned to each user by OS for its reference. ∑ In Linux, we can create usernames with capital letters also, but best practice is to follow lower cases. To check whether a user is created or not, we can use any one of the below ways, ∑ Using "id" command, [root@sys1 ~]# id john uid=501(john) gid=501(john) groups=501(john)
  • 3. ∑ Checking from /etc/passwd file, [root@sys2 ~]# grep john /etc/passwd john:x:501:502:systemadmin:/home/john:/bin/bash Note: ∑ usernames are case sensitive in Linux and UNIX Flavors. Type, id JOHN and see the output. ∑ If the group doesn’t exist already, then they are created by default with the user name. Default attributes for new user: The default attributes for a normal user are user id and group id given by the system. Default working directory is ‘/home/’ The default shell is bash shell. For example, Creating a user in linux machine with default attributes. The syntax is, #useradd <sampleusername> [root@sys2 ~]# useradd steve Checking the details in /etc/passwd file, [root@sys2 ~]# grep steve /etc/passwd [root@sys2 ~]# grep steve /etc/passwd steve:x:503:503::/home/steve:/bin/bash Topic review through questions: 1. How to create a new user in Linux machine? 2. what is the userid value of a user? detail about reserved userid values?
  • 4. 3. Can we have a username in capital letters in Linux machine? 4. Where does the default attributes of a user stored?