SlideShare a Scribd company logo
2
Most read
5
Most read
7
Most read
Linux - User
Administration
Samuel OJO
Introduction
In this section, I will discuss in detail about user
administration in Linux.
There are three main types of user accounts on a
Linux Server:
Root, System and User Accounts
ROOT ACCOUNT
This is also called superuser and would
have complete control of the Linux
system. A superuser can run any
commands without any restriction. This
user should therefore not be used to
access the system directly, it should be
assumed as a system administrator.
SYSTEM ACCOUNTS
•System accounts are those needed for the
operation of system-specific components,
for example mail accounts and
the sshd accounts. These accounts are
usually needed for some specific function
on your Linux system, and any
modifications to them could adversely
affect the system.
USER ACCOUNTS
User accounts provide interactive access to the system
for users and groups. General users are typically
assigned to these accounts and usually have limited
access to critical system files and directories.
Linux uses Group Account which logically groups a
number of accounts. Every account would be a part of
another group account. A group plays important role in
handling file permissions and process management.
MANAGING USERS AND GROUPS IN LINUX
There are four main user administration files −
1. /etc/passwd − Keeps the user account and password
information. This file holds the majority of information about
accounts on the Unix system.
2. /etc/shadow − Holds the encrypted password of the
corresponding account. Not all the systems support this file.
3. /etc/group − This file contains the group information for
each account.
4. /etc/gshadow − This file contains secure group account
information.
BASIC USER ADMINISTRATION COMMANDS
1 Useradd: - Adds accounts to the system
2 Usermod: - Modifies account attributes
3 Userdel: - Deletes accounts from the system
4 Groupadd: - Adds groups to the system
5 Groupmod: - Modifies group attributes
6 Groupdel: - Removes groups from the system
CREATE A GROUP
groupadd [-g gid [-o]] [-r] [-f] groupname --OR-- groupadd local_admin
1 -g GID - - The numerical value of the group's ID
2 -o -- This option permits to add group with non-unique GID
3 -r -- This flag instructs groupadd to add a system account
4 -f -- This option causes to just exit with success status
5 groupname --- Actual group name to be created
$ groupadd developers
MODIFY A GROUP
To modify a group, use
the groupmod syntax −
$ groupmod -n new_group_name old_group_name
$ groupmod -n sysadmin local_admin
$ groupmod -g 484 sysadmin
DELETE A GROUP
We will quickly look at how to delete a group. To delete
an existing group, all you need is the groupdel
command and the group name, e.g:
$ groupdel local_admin
This removes only the group, not the files associated with
that group. The files are still accessible by their owners.
CREATE AN ACCOUNT
1 -d homedir
Specifies home directory for the account
2 -g groupname
Specifies a group account for this account
3 -m
Creates the home directory if it doesn't exist
4 -s shell
Specifies the default shell for this account
5 -u userid
You can specify a user id for this account
6 accountname
Actual account name to be created
useradd -d homedir -g groupname -m -s shell -u userid accountname
If you do not specify any parameter, then the system makes use of the
default values. The useradd command modifies the /etc/passwd,
/etc/shadow, and /etc/group files and creates a home directory.
This is the example that creates an account samojo, setting its home
directory to /home/samojo and the group as sysadmin. This user would
have Korn Shell assigned to it
$ useradd -d /home/samojo -g sysadmin -s /bin/ksh samojo
Before issuing the above command, make sure you already have the
sysadmin group created using the groupadd command.
Once an account is created you can set its password using
the passwd command. E.g passwd samojo
MODIFY AN ACCOUNT
The usermod command enables you to make changes to
an existing account from the command line. It uses the
same arguments as the useradd command, plus the -l
argument, which allows you to change the account name.
Eg, to change the account name samojo to samojo00 and
to change home directory accordingly
$ usermod -d /home/samojo00 -m -l samojo samojo00
DELETE AN ACCOUNT
The userdel command can be used to delete an existing user. This
is a very dangerous command if not used with caution.
There is only one argument or option available for the
command .r, for removing the account's home directory and mail
file. Eg, to remove account samojo00, type the command:
$ userdel -r samojo00
If you want to keep the home directory for backup purposes, omit
the -r option. You can remove the home directory as needed at a
later time

More Related Content

What's hot (20)

PPTX
User management
Mufaddal Haidermota
 
PPT
Linux Administration
Harish1983
 
PPTX
Linux basic commands
Sagar Kumar
 
PDF
Linux Basic Commands
Hanan Nmr
 
PDF
Users and groups in Linux
Knoldus Inc.
 
PPT
Linux file system
Burhan Abbasi
 
PDF
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
PPT
Linux command ppt
kalyanineve
 
PPTX
Linux security
trilokchandra prakash
 
PDF
Shell scripting
Geeks Anonymes
 
PDF
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Edureka!
 
PPTX
Basic commands of linux
shravan saini
 
PPT
Linux Commands
Ramasubbu .P
 
PPTX
Introduction 2 linux
Papu Kumar
 
PDF
Basic linux commands
Shakeel Shafiq
 
PDF
Shell scripting
Manav Prasad
 
PPTX
Linux commands
penetration Tester
 
PPT
Linux presentation
Nikhil Jain
 
PDF
Complete Guide for Linux shell programming
sudhir singh yadav
 
PDF
Kali linux commands
Jubair Ahmed Junjun
 
User management
Mufaddal Haidermota
 
Linux Administration
Harish1983
 
Linux basic commands
Sagar Kumar
 
Linux Basic Commands
Hanan Nmr
 
Users and groups in Linux
Knoldus Inc.
 
Linux file system
Burhan Abbasi
 
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Linux command ppt
kalyanineve
 
Linux security
trilokchandra prakash
 
Shell scripting
Geeks Anonymes
 
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Edureka!
 
Basic commands of linux
shravan saini
 
Linux Commands
Ramasubbu .P
 
Introduction 2 linux
Papu Kumar
 
Basic linux commands
Shakeel Shafiq
 
Shell scripting
Manav Prasad
 
Linux commands
penetration Tester
 
Linux presentation
Nikhil Jain
 
Complete Guide for Linux shell programming
sudhir singh yadav
 
Kali linux commands
Jubair Ahmed Junjun
 

Similar to User Administration in Linux (20)

PPTX
Lecturehjiwiiiwiiiwiiiiwiiijjwjiwii.pptx
ilhammatinzai842
 
PPT
Unix Administration 3
Information Technology
 
PPTX
7 - User Administration in Red Hat
Shafaan Khaliq Bhatti
 
PDF
Manage Local Users and Groups - RHCSA (RH124)
RHCSA Guru
 
PPTX
User and groups administrator
Aisha Talat
 
PDF
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
KiyanaSharma1
 
PPT
06 users groups_and_permissions
Shay Cohen
 
PPTX
Presentation1
Engr Zardari Saddam
 
PPT
Week7 downloading and installing software (1).ppt
no22rah1
 
PPT
Week7. linux. operating. system. .ppt
no22rah1
 
PPT
Common linux ubuntu commands overview
Ameer Sameer
 
PPTX
Linux+Command+Line+&+Shell+Scripting+Masterclass+-+Final.pptx
newscribduserly
 
PDF
Linux fundamental - Chap 13 account management
Kenny (netman)
 
PDF
User Management Command Cheat Sheet.pdf
LinuxTeck
 
PPT
Introduction to Unix
Sudharsan S
 
PPT
Linux
sravan kumar
 
PDF
ManagingLocalLinuxUsersandGroups(2)
Bipul Kumar
 
PDF
Useradmin
ARYA TM
 
PPT
chapter11.. linux. Managing Users . ppt
no22rah1
 
Lecturehjiwiiiwiiiwiiiiwiiijjwjiwii.pptx
ilhammatinzai842
 
Unix Administration 3
Information Technology
 
7 - User Administration in Red Hat
Shafaan Khaliq Bhatti
 
Manage Local Users and Groups - RHCSA (RH124)
RHCSA Guru
 
User and groups administrator
Aisha Talat
 
A Complete Guide to “useradd” Command in Linux with Examples _ Hostbillo
KiyanaSharma1
 
06 users groups_and_permissions
Shay Cohen
 
Presentation1
Engr Zardari Saddam
 
Week7 downloading and installing software (1).ppt
no22rah1
 
Week7. linux. operating. system. .ppt
no22rah1
 
Common linux ubuntu commands overview
Ameer Sameer
 
Linux+Command+Line+&+Shell+Scripting+Masterclass+-+Final.pptx
newscribduserly
 
Linux fundamental - Chap 13 account management
Kenny (netman)
 
User Management Command Cheat Sheet.pdf
LinuxTeck
 
Introduction to Unix
Sudharsan S
 
ManagingLocalLinuxUsersandGroups(2)
Bipul Kumar
 
Useradmin
ARYA TM
 
chapter11.. linux. Managing Users . ppt
no22rah1
 
Ad

Recently uploaded (20)

PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
July Patch Tuesday
Ivanti
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Ad

User Administration in Linux

  • 2. Introduction In this section, I will discuss in detail about user administration in Linux. There are three main types of user accounts on a Linux Server: Root, System and User Accounts
  • 3. ROOT ACCOUNT This is also called superuser and would have complete control of the Linux system. A superuser can run any commands without any restriction. This user should therefore not be used to access the system directly, it should be assumed as a system administrator.
  • 4. SYSTEM ACCOUNTS •System accounts are those needed for the operation of system-specific components, for example mail accounts and the sshd accounts. These accounts are usually needed for some specific function on your Linux system, and any modifications to them could adversely affect the system.
  • 5. USER ACCOUNTS User accounts provide interactive access to the system for users and groups. General users are typically assigned to these accounts and usually have limited access to critical system files and directories. Linux uses Group Account which logically groups a number of accounts. Every account would be a part of another group account. A group plays important role in handling file permissions and process management.
  • 6. MANAGING USERS AND GROUPS IN LINUX There are four main user administration files − 1. /etc/passwd − Keeps the user account and password information. This file holds the majority of information about accounts on the Unix system. 2. /etc/shadow − Holds the encrypted password of the corresponding account. Not all the systems support this file. 3. /etc/group − This file contains the group information for each account. 4. /etc/gshadow − This file contains secure group account information.
  • 7. BASIC USER ADMINISTRATION COMMANDS 1 Useradd: - Adds accounts to the system 2 Usermod: - Modifies account attributes 3 Userdel: - Deletes accounts from the system 4 Groupadd: - Adds groups to the system 5 Groupmod: - Modifies group attributes 6 Groupdel: - Removes groups from the system
  • 8. CREATE A GROUP groupadd [-g gid [-o]] [-r] [-f] groupname --OR-- groupadd local_admin 1 -g GID - - The numerical value of the group's ID 2 -o -- This option permits to add group with non-unique GID 3 -r -- This flag instructs groupadd to add a system account 4 -f -- This option causes to just exit with success status 5 groupname --- Actual group name to be created $ groupadd developers
  • 9. MODIFY A GROUP To modify a group, use the groupmod syntax − $ groupmod -n new_group_name old_group_name $ groupmod -n sysadmin local_admin $ groupmod -g 484 sysadmin
  • 10. DELETE A GROUP We will quickly look at how to delete a group. To delete an existing group, all you need is the groupdel command and the group name, e.g: $ groupdel local_admin This removes only the group, not the files associated with that group. The files are still accessible by their owners.
  • 11. CREATE AN ACCOUNT 1 -d homedir Specifies home directory for the account 2 -g groupname Specifies a group account for this account 3 -m Creates the home directory if it doesn't exist 4 -s shell Specifies the default shell for this account 5 -u userid You can specify a user id for this account 6 accountname Actual account name to be created useradd -d homedir -g groupname -m -s shell -u userid accountname
  • 12. If you do not specify any parameter, then the system makes use of the default values. The useradd command modifies the /etc/passwd, /etc/shadow, and /etc/group files and creates a home directory. This is the example that creates an account samojo, setting its home directory to /home/samojo and the group as sysadmin. This user would have Korn Shell assigned to it $ useradd -d /home/samojo -g sysadmin -s /bin/ksh samojo Before issuing the above command, make sure you already have the sysadmin group created using the groupadd command. Once an account is created you can set its password using the passwd command. E.g passwd samojo
  • 13. MODIFY AN ACCOUNT The usermod command enables you to make changes to an existing account from the command line. It uses the same arguments as the useradd command, plus the -l argument, which allows you to change the account name. Eg, to change the account name samojo to samojo00 and to change home directory accordingly $ usermod -d /home/samojo00 -m -l samojo samojo00
  • 14. DELETE AN ACCOUNT The userdel command can be used to delete an existing user. This is a very dangerous command if not used with caution. There is only one argument or option available for the command .r, for removing the account's home directory and mail file. Eg, to remove account samojo00, type the command: $ userdel -r samojo00 If you want to keep the home directory for backup purposes, omit the -r option. You can remove the home directory as needed at a later time

Editor's Notes

  • #7: Check all the above files using the cat command.
  • #8: You can use Manpage Help to check complete syntax for each command mentioned here.
  • #9: If you do not specify any parameter, then the system makes use of the default values. Following example creates a local_admin group with default values, which is very much acceptable for most of the administrators.
  • #13: When you type passwd accountname, it gives you an option to change the password, provided you are a superuser. Otherwise, you can change just your password using the same command but without specifying your account name.