CoSc3063 - NSA - Chapter - 2 - Lesson 2
CoSc3063 - NSA - Chapter - 2 - Lesson 2
Administration
Chapter 2: Host And User Manegment
Computer science 3rd Year, 1st Sem.
Fitsum Gizachew (BSc students_2014)
Topics to be covered
Lesson 2: User Management • Source
– How Linux user account work
• “Principles of Network and
– Managing user account
System Administration” (2nd
– How Linux group work Edition), John Wiley and Sons
– Manage ownership, permissions, Ltd, Mark Burgess, 2004.
and quotas • “Essential System
Administration”, 3rd Edition,
O’Reilly and Associates Inc.,
Ǽleen Frisch, 2003.
2
Manage users account
3
How Linux User Accounts Work
Username
Password
By default, all user home directories are created and
4
Where Linux User Accounts Are Stored
5
Cont…
/etc/passwd: file contains the user account information
for your system.
/etc/shadow: file contains passwords for your user
accounts.
/etc/group: file contains your system’s groups.
6
Creating and Managing User Accounts from the
Command Line
7
Using useradd
8
You can also view these default values by
entering useradd –D at the shell prompt.
Option
–c Includes the user’s full name
–e Specifies the date when the user account will be disabled
–f Specifies the number of days after password expiration before the account is
disabled.
–g Specifies the user’s default group
–G Specifies additional groups that the user is to be made a member of.
9
- Using passwd
The passwd utility is used to change an existing user’s
password
You can find out this information using the –S option
with passwd
Syntax: passwd username
10
Options
–w Sets the number of days prior to password expiration when the user will be
warned of the pending expiration.
–i Sets the number of days to wait after a password has expired to disable the
account.
11
- Using usermod
From time to time, you will need to modify an existing user account.
Syntax: usermod options username
Options
–e Sets the date when the user account will be disabled. Format the date as yyyy-mm-dd.
–f Sets the number of days after password expiration before the account is disabled. Use a value of –1 to disable this
functionality.
–L Locks the user’s account. This option invalidates the user’s password
13
2. How Linux Groups Work
How Linux groups work
Managing groups from the command line
• Linux Groups
If your Linux system has been configured to use local
authentication, your groups are defined in the /etc/group
file. Each record is composed of the following four fields:
Group:Password:GID:Users
Group Specifies the name of the group.
Password Specifies the group password.
GID Specifies the group ID (GID) number of the group.
Users Lists the members of the group.
14
Managing groups account from the
command line
Using groupadd
Using groupmod
Using groupdel
15
- Using groupadd
Syntax:
groupadd options groupname
Options:
–g Specifies a GID for the new group.
–p Specifies a password for the group.
–r Specifies that the group being created is a system group.
16
- Using groupmod
To modify a group, including adding users to the group
membership, you use the groupmod utility.
Syntax:
groupmod options group
Options:
–g Changes the group’s GID number.
–p Changes the group’s password.
–A Adds a user account to the group.
–R Removes a user account from the group.
If we wanted to add student to the group, we would enter
groupmod –A “student” at the shell prompt.
17
- Using groupdel
18
3. Manage ownership, permissions
Managing ownership
Managing permissions
Managing ownership
19
• How ownership works
20
• Managing ownership from the
command line
You can specify a different user and/or group as the
owner of a given file or directory. To change the
user who owns a file, you must be logged in as root.
To change the group that owns a file, you must be
logged in as root or as the user who currently owns
the file.
Using chown
Using chgrp
21
- Using chown
22
chown
23
- Using chgrp
24
Managing permissions
25
Access to files in Linux is based on permissions
Each user and group has different permissions regarding access
to files
Available permissions
read, write, execute, and no permission
Three types of users in Linux
User: username of the person who owns the file
Group: set of users
Other: user who isn't the owner of the file and doesn't belong
in the same group the file does
Everyone else other than user and group
26
- How permissions work
27
- Managing Permissions from the Command
Line with chmod
chmod entity=permissions filename
28
29
Thank you
?
30