SlideShare a Scribd company logo
Adding New Users
and
Storage
Prepared By
Prof. Bhushan Pawar
www.bhushanpawar.com
Prof.Bhushan Pawar
www.bhushanpawar.com
1
The /etc/passwd file
• /etc/passwd file is a list of users recognized by
the system.
• The system consults /etc/passwd at login time
to determine a user’s UID and home directory,
among other things.
Prof.Bhushan Pawar
www.bhushanpawar.com
2
Continue…
• It contains seven fields separated by colons:
• Login name
• Encrypted password
• UID (user ID) number
• Default GID (group ID) number
• “GECOS” information: full name, office,
extension, home phone
• Home directory
• Login shell
Prof.Bhushan Pawar
www.bhushanpawar.com
3
Continue…
• E.g
root:x:0:0:The System,,x6096,:/:/bin/sh
- The passwd file contains an x in the encrypted
password field on Linux, Solaris.
• The actual encrypted passwords are stored in
/etc/shadow on Linux, Solaris.
Prof.Bhushan Pawar
www.bhushanpawar.com
4
Login name
• Must be unique and, depending on the
operating system, may have length and
character set restrictions.
• Login names can never contain colons or
newlines because these characters are used as
field separators and entry separators.
Prof.Bhushan Pawar
www.bhushanpawar.com
5
Continue…
Prof.Bhushan Pawar
www.bhushanpawar.com
6
Encrypted password
• The encrypted password in the /etc/passwd
file
Prof.Bhushan Pawar
www.bhushanpawar.com
7
UID (user ID) number
• UIDs are usually unsigned 32-bit integers.
• Root has UID 0.
Prof.Bhushan Pawar
www.bhushanpawar.com
8
Default GID number
• A group ID number is a 32-bit integer.
• GID 0 is reserved for the group called root or
system.
• The /etc/group file defines the groups, with
the GID field in /etc/passwd providing a
default (or “effective”) GID at login time
Prof.Bhushan Pawar
www.bhushanpawar.com
9
GECOS field
• The GECOS field is sometimes used to record
personal information about each user.
• The chfn command lets users change their
own GECOS information.
• On most systems chfn understands only the
/etc/passwd file
Prof.Bhushan Pawar
www.bhushanpawar.com
10
Home directory
• If the home directory is missing at login time,
the system prints a message such as “no
home directory” and puts the user in /.
• On Linux, if /etc/login.defs sets
DEFAULT_HOME to no, the login is not
allowed to continue.
Prof.Bhushan Pawar
www.bhushanpawar.com
11
Login shell
• The login shell is normally a command
interpreter such as the Bourne shell or the C
shell (/bin/sh or /bin/csh), but it can be any
program.
• sh is the traditional default for UNIX, and bash
(the GNU “Bourne again” shell) is the default
for Linux and Solaris.
• tcsh is an enhanced C shell with command
editing.
Prof.Bhushan Pawar
www.bhushanpawar.com
12
THE /ETC/SHADOW AND
/ETC/SECURITY/PASSWD FILES
• A shadow password file is readable only by
the superuser and serves to keep encrypted
passwords.
• IBM calls the file that stores the encrypted
passwords /etc/security/passwd, while the
rest of the world calls it /etc/shadow.
Prof.Bhushan Pawar
www.bhushanpawar.com
13
/etc/shadow
• The shadow file is not a superset of the
passwd file, and the passwd file is not
generated from it. We must maintain both
files or use tools such as useradd that
maintain both files on your behalf. Like
/etc/passwd, /etc/shadow contains one line
for each user. Each line contains nine fields,
separated by colons
Prof.Bhushan Pawar
www.bhushanpawar.com
14
Continue…
• Login name
• Encrypted password
• Date of last password change
• Minimum number of days between password changes
• Maximum number of days between password changes
• Number of days in advance to warn users about password
expiration
• Linux: Days after password expiration that account is disabled
Solaris/HP-UX: Days before account automatically expires
• Account expiration date
• A reserved field that is currently always empty, except on
Solaris Prof.Bhushan Pawar
www.bhushanpawar.com
15
THE /ETC/GROUP FILE
• The /etc/group file contains the names of UNIX
groups and a list of each group’s members.
• Each line represents one group and contains four
fields:
• Group name
• Encrypted password or a placeholder
• GID number
• List of members, separated by commas (be
careful not to add spaces)
Prof.Bhushan Pawar
www.bhushanpawar.com
16
example
1. system:!:0:root,pconsole,esaadmin
2. staff:!:1:ipsec,esaadmin,trent,ben,garth,evi
3. bin:!:2:root,bin
4. sys:!:3:root,bin,sys
5. adm:!:4:bin,adm
6. nobody:!:4294967294:nobody,lpd
Prof.Bhushan Pawar
www.bhushanpawar.com
17
ADDING USERS: THE BASIC STEPS
• The process of adding a new user consists of
several steps required by the system:
– Have the new user sign your policy agreement.
– Edit the passwd and shadow files to define the
user’s account.
– Add the user to the /etc/group file (not really
necessary, but nice).
– Set an initial password.
– Create, chown, and chmod the user’s home
directory.
– Configure roles and permissions
Prof.Bhushan Pawar
www.bhushanpawar.com
18
Continue…
• For the user:
– Copy default startup files to the user’s home
directory.
– Set the user’s mail home and establish mail
aliases.
• For you:
– Verify that the account is set up correctly.
– Add the user’s contact information and account
status to your database
Prof.Bhushan Pawar
www.bhushanpawar.com
19
Continue…
• You must be root to add a user, you must have
Admin privileges.
• This is a perfect place to use sudo.
• For this we can use “useradd” or “adduser”
command.
Prof.Bhushan Pawar
www.bhushanpawar.com
20
Editing the passwd and group files
• If you have to add a user by hand, use vipw to
edit the passwd and shadow files.
• NOTE:-
– On Solaris, and Red Hat systems, vipw
automatically asks if you would like to edit the
shadow file after you have edited the passwd file.
SUSE and Ubuntu systems use vipw -s for this
function.
Prof.Bhushan Pawar
www.bhushanpawar.com
21
Setting a password
• Set a password for the new user with
$ sudo passwd newusername
Prof.Bhushan Pawar
www.bhushanpawar.com
22
Creating the home directory and
installing startup files
• You can create the new user’s home directory
with a simple mkdir.
• Startup files traditionally begin with a dot and
end with the letters rc, short for “run command,”
• The initial dot causes ls to hide these
“uninteresting” files from directory listings unless
the -a option is used.
• Sample startup files are traditionally kept in
/etc/skel (Linux, Solaris, HP-UX) or /etc
Prof.Bhushan Pawar
www.bhushanpawar.com
23
Prof.Bhushan Pawar
www.bhushanpawar.com
24
Setting permissions and ownerships
• The command
– $ sudo chown -R newuser:newgroup ~newuser
Prof.Bhushan Pawar
www.bhushanpawar.com
25
Any Question???
• If you having any doubt then you can ask me
question on
bhushan.pawar@mescoepune.org
Or
contact me on (+91)-7588318728
Prof.Bhushan Pawar
www.bhushanpawar.com
26

More Related Content

PPT
Unix fundamentals
PPT
Lpi lição 01 exam 102 objectives
PPT
101 4.3 control mounting and unmounting of filesystems
PPTX
Unix features, posix and single unix specification
PPT
Edubooktraining
PPT
101 4.4 manage disk quotas
DOCX
The linux file system structure
PPTX
11 linux filesystem copy
Unix fundamentals
Lpi lição 01 exam 102 objectives
101 4.3 control mounting and unmounting of filesystems
Unix features, posix and single unix specification
Edubooktraining
101 4.4 manage disk quotas
The linux file system structure
11 linux filesystem copy

What's hot (20)

PPT
Unix file systems 2 in unix internal systems
PPT
Linux filesystemhierarchy
PPT
Linux training
PPT
Linux: Basics OF Linux
PPTX
Linux standard file system
PDF
Module 3 Using Linux Softwares.
DOCX
Introduction to unix
PPTX
Unix & Linux File System in Operating System
PPT
101 1.2 boot the system
PDF
From Drives to URLs
PPTX
File system structure in linux
PDF
Module 1 introduction to Linux
PPT
Basic Unix
PPT
Unix Administration 3
PPTX
PPT
Linux fundamentals Training
PPTX
Unix operating system architecture with file structure
Unix file systems 2 in unix internal systems
Linux filesystemhierarchy
Linux training
Linux: Basics OF Linux
Linux standard file system
Module 3 Using Linux Softwares.
Introduction to unix
Unix & Linux File System in Operating System
101 1.2 boot the system
From Drives to URLs
File system structure in linux
Module 1 introduction to Linux
Basic Unix
Unix Administration 3
Linux fundamentals Training
Unix operating system architecture with file structure
Ad

Similar to Unit 6 adding new users and storage (20)

PPTX
7 - User Administration in Red Hat
PPTX
Lecturehjiwiiiwiiiwiiiiwiiijjwjiwii.pptx
PPTX
Chapter 3 LectureChapter 3 LectureChapter 3 Lecture.pptx
PDF
ManagingLocalLinuxUsersandGroups(2)
PPT
06 users groups_and_permissions
PDF
Linux fundamental - Chap 13 account management
PPTX
User and groups administrator
PPT
Week7 downloading and installing software (1).ppt
PPT
Week7. linux. operating. system. .ppt
DOCX
lec1.docx
PDF
7 unixsecurity
PDF
Users and groups in Linux
PDF
User and group administration in Linux
PPTX
Licão 04 permissions
DOC
58518522 study-aix
PPT
Host security
PPT
Host security
PPT
Linux lecture
PPT
7 - User Administration in Red Hat
Lecturehjiwiiiwiiiwiiiiwiiijjwjiwii.pptx
Chapter 3 LectureChapter 3 LectureChapter 3 Lecture.pptx
ManagingLocalLinuxUsersandGroups(2)
06 users groups_and_permissions
Linux fundamental - Chap 13 account management
User and groups administrator
Week7 downloading and installing software (1).ppt
Week7. linux. operating. system. .ppt
lec1.docx
7 unixsecurity
Users and groups in Linux
User and group administration in Linux
Licão 04 permissions
58518522 study-aix
Host security
Host security
Linux lecture
Ad

More from Bhushan Pawar -Java Trainer (6)

PDF
Unit 5 access control,rootly powers & controlling processes
PDF
Unit 4 scripting and the shell
PDF
Unit 4 booting & shut down
PDF
Unit 1 introduction to operating system
PDF
Scripting and the shell in LINUX
PDF
Booting & shut down,
Unit 5 access control,rootly powers & controlling processes
Unit 4 scripting and the shell
Unit 4 booting & shut down
Unit 1 introduction to operating system
Scripting and the shell in LINUX
Booting & shut down,

Recently uploaded (20)

PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Well-logging-methods_new................
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
Geodesy 1.pptx...............................................
PDF
Digital Logic Computer Design lecture notes
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Sustainable Sites - Green Building Construction
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Welding lecture in detail for understanding
Model Code of Practice - Construction Work - 21102022 .pdf
Well-logging-methods_new................
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Foundation to blockchain - A guide to Blockchain Tech
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Geodesy 1.pptx...............................................
Digital Logic Computer Design lecture notes
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Sustainable Sites - Green Building Construction
Automation-in-Manufacturing-Chapter-Introduction.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
R24 SURVEYING LAB MANUAL for civil enggi
Welding lecture in detail for understanding

Unit 6 adding new users and storage

  • 1. Adding New Users and Storage Prepared By Prof. Bhushan Pawar www.bhushanpawar.com Prof.Bhushan Pawar www.bhushanpawar.com 1
  • 2. The /etc/passwd file • /etc/passwd file is a list of users recognized by the system. • The system consults /etc/passwd at login time to determine a user’s UID and home directory, among other things. Prof.Bhushan Pawar www.bhushanpawar.com 2
  • 3. Continue… • It contains seven fields separated by colons: • Login name • Encrypted password • UID (user ID) number • Default GID (group ID) number • “GECOS” information: full name, office, extension, home phone • Home directory • Login shell Prof.Bhushan Pawar www.bhushanpawar.com 3
  • 4. Continue… • E.g root:x:0:0:The System,,x6096,:/:/bin/sh - The passwd file contains an x in the encrypted password field on Linux, Solaris. • The actual encrypted passwords are stored in /etc/shadow on Linux, Solaris. Prof.Bhushan Pawar www.bhushanpawar.com 4
  • 5. Login name • Must be unique and, depending on the operating system, may have length and character set restrictions. • Login names can never contain colons or newlines because these characters are used as field separators and entry separators. Prof.Bhushan Pawar www.bhushanpawar.com 5
  • 7. Encrypted password • The encrypted password in the /etc/passwd file Prof.Bhushan Pawar www.bhushanpawar.com 7
  • 8. UID (user ID) number • UIDs are usually unsigned 32-bit integers. • Root has UID 0. Prof.Bhushan Pawar www.bhushanpawar.com 8
  • 9. Default GID number • A group ID number is a 32-bit integer. • GID 0 is reserved for the group called root or system. • The /etc/group file defines the groups, with the GID field in /etc/passwd providing a default (or “effective”) GID at login time Prof.Bhushan Pawar www.bhushanpawar.com 9
  • 10. GECOS field • The GECOS field is sometimes used to record personal information about each user. • The chfn command lets users change their own GECOS information. • On most systems chfn understands only the /etc/passwd file Prof.Bhushan Pawar www.bhushanpawar.com 10
  • 11. Home directory • If the home directory is missing at login time, the system prints a message such as “no home directory” and puts the user in /. • On Linux, if /etc/login.defs sets DEFAULT_HOME to no, the login is not allowed to continue. Prof.Bhushan Pawar www.bhushanpawar.com 11
  • 12. Login shell • The login shell is normally a command interpreter such as the Bourne shell or the C shell (/bin/sh or /bin/csh), but it can be any program. • sh is the traditional default for UNIX, and bash (the GNU “Bourne again” shell) is the default for Linux and Solaris. • tcsh is an enhanced C shell with command editing. Prof.Bhushan Pawar www.bhushanpawar.com 12
  • 13. THE /ETC/SHADOW AND /ETC/SECURITY/PASSWD FILES • A shadow password file is readable only by the superuser and serves to keep encrypted passwords. • IBM calls the file that stores the encrypted passwords /etc/security/passwd, while the rest of the world calls it /etc/shadow. Prof.Bhushan Pawar www.bhushanpawar.com 13
  • 14. /etc/shadow • The shadow file is not a superset of the passwd file, and the passwd file is not generated from it. We must maintain both files or use tools such as useradd that maintain both files on your behalf. Like /etc/passwd, /etc/shadow contains one line for each user. Each line contains nine fields, separated by colons Prof.Bhushan Pawar www.bhushanpawar.com 14
  • 15. Continue… • Login name • Encrypted password • Date of last password change • Minimum number of days between password changes • Maximum number of days between password changes • Number of days in advance to warn users about password expiration • Linux: Days after password expiration that account is disabled Solaris/HP-UX: Days before account automatically expires • Account expiration date • A reserved field that is currently always empty, except on Solaris Prof.Bhushan Pawar www.bhushanpawar.com 15
  • 16. THE /ETC/GROUP FILE • The /etc/group file contains the names of UNIX groups and a list of each group’s members. • Each line represents one group and contains four fields: • Group name • Encrypted password or a placeholder • GID number • List of members, separated by commas (be careful not to add spaces) Prof.Bhushan Pawar www.bhushanpawar.com 16
  • 17. example 1. system:!:0:root,pconsole,esaadmin 2. staff:!:1:ipsec,esaadmin,trent,ben,garth,evi 3. bin:!:2:root,bin 4. sys:!:3:root,bin,sys 5. adm:!:4:bin,adm 6. nobody:!:4294967294:nobody,lpd Prof.Bhushan Pawar www.bhushanpawar.com 17
  • 18. ADDING USERS: THE BASIC STEPS • The process of adding a new user consists of several steps required by the system: – Have the new user sign your policy agreement. – Edit the passwd and shadow files to define the user’s account. – Add the user to the /etc/group file (not really necessary, but nice). – Set an initial password. – Create, chown, and chmod the user’s home directory. – Configure roles and permissions Prof.Bhushan Pawar www.bhushanpawar.com 18
  • 19. Continue… • For the user: – Copy default startup files to the user’s home directory. – Set the user’s mail home and establish mail aliases. • For you: – Verify that the account is set up correctly. – Add the user’s contact information and account status to your database Prof.Bhushan Pawar www.bhushanpawar.com 19
  • 20. Continue… • You must be root to add a user, you must have Admin privileges. • This is a perfect place to use sudo. • For this we can use “useradd” or “adduser” command. Prof.Bhushan Pawar www.bhushanpawar.com 20
  • 21. Editing the passwd and group files • If you have to add a user by hand, use vipw to edit the passwd and shadow files. • NOTE:- – On Solaris, and Red Hat systems, vipw automatically asks if you would like to edit the shadow file after you have edited the passwd file. SUSE and Ubuntu systems use vipw -s for this function. Prof.Bhushan Pawar www.bhushanpawar.com 21
  • 22. Setting a password • Set a password for the new user with $ sudo passwd newusername Prof.Bhushan Pawar www.bhushanpawar.com 22
  • 23. Creating the home directory and installing startup files • You can create the new user’s home directory with a simple mkdir. • Startup files traditionally begin with a dot and end with the letters rc, short for “run command,” • The initial dot causes ls to hide these “uninteresting” files from directory listings unless the -a option is used. • Sample startup files are traditionally kept in /etc/skel (Linux, Solaris, HP-UX) or /etc Prof.Bhushan Pawar www.bhushanpawar.com 23
  • 25. Setting permissions and ownerships • The command – $ sudo chown -R newuser:newgroup ~newuser Prof.Bhushan Pawar www.bhushanpawar.com 25
  • 26. Any Question??? • If you having any doubt then you can ask me question on bhushan.pawar@mescoepune.org Or contact me on (+91)-7588318728 Prof.Bhushan Pawar www.bhushanpawar.com 26