M01:
Introduction to Operating Systems |
TU1: Installing, configuring
and exploiting a computer system |
ASIX1 |
Practical Exercise 10: Managing users and groups accounts | 17-2-13 |
Practical Exercise 10:
Managing users and groups accounts
CONFIGURING USER AND GROUP ACCOUNTS
1-
Introduction
A user is a real person, or process, or device which uses
or access to some resources of a computer such as folders,
files, programs, hardware and so on. A group is a collection of
users. Groups are used as a basis for determining file access
permissions. It depends on your groups membership that you will
be able to access or not to certain folders, files, hardware,
databases and so on.
In order to define
properly a new user, you must provide to the system some basic
information. A system user will need:
a) A username
b) Usually, an encrypted
password
c) A set of necessary files
directories, and permissions. For instance, its home directory.
d) A numerical value
called User IDentifier or UID associated with the
username. The user will be identified by the system thanks to
its UID rather than its username.
e) A default group. A user
must be member of one or more groups. If a user is member of
just one group, that group will be its default group. The group
name must exist. Instead of a group name, you can write the
unique number that identifies the group.
f) A default shell, usually
/bin/bash.
g) Another characteristics
like comments, expiry date, additional groups memberships and so
on.
h) An entry in files
/etc/passwd and /etc/shadow.
In order to define
properly a new group, you must provide to the system some basic
information. A system group will need:
a) A group name.
b) A numerical value called Group
IDentifier or GID associated with the group name. The
group will be identified by the system thanks to its GID
rather than its group name.
c) Users which are
member of that group.
The purpose of
this exercise is to learn how to manage user and group account
on Linux and particularly, with the Ubuntu distribution. We will
learn how to add and delete system users and grups.
Additionally, we will study the main chararacterisitics
of system user and groups, and how to modify these
characteristics. In order to configure and manage system users
and groups, the Linux operating provides you with a
poerful set of command-line utilities: a) useradd adds
a new user account to the system, b) userdel deletes
a user's account, c) usermod modifies a user's
account, d) groupadd adds a new group to the
system, e) groupdel removes a group and f) groupmod
modifies a group. If your computer runs Ubuntu
Linux, a GUI utility called user-admin will help to
configure and manage easily your system users and groups.
2-
mkpasswd
a)
Descrition: The command-line utility mkpasswd encrypts a given password.
b) Synopis: mkpasswd PASSWORD
c) As a result, a encrypted version of PASSWORD will
be displayed on screen
d) Example:
linux:~ # mkpasswd mst1298
NvwgZmyymrgZQ
e) When you run
the useradd command
(read section 3), you should use the result of this
command with the -p
option.
4-
userdel
a)
Description: The useradel
command deletes an user account.
b) Synopsis 1: userdel username ==> The user
will be deleted but not its home folder. Entries in /etc/passwd,
/etc/shadow and /etc/group will be deleted. Folder
/home/username will not be deleted.
c) Synopsis 2: userdel -r
username ==> The user will be
deleted and its home folder as well. Entries in
/etc/passwd, /etc/shadow and /etc/group will be deleted. Folder
/home/username will be deleted.
d) Example: If you want to
completely remove the user master, you should run the following
command: userdel
-r master
9- gpasswd: Removing a user from a group. Adding a user to a group
PRACTICAL EXERCISE
1- Open the
terminal. Create a new user called clot2014,
which is part of the users group, whose home directory is /home/clot2014,
whose shell is the bash program, and whose encrypted
password is PWDclot2014. User doesn't need more
information. UID will be 2014. Look at changes at /etc/passwd and /etc/shadow.
2-
Working on terminal. Create alumnes11 group with GID = 211. Look at changes at /etc/group
3- Working on terminal. Modify clot2014's UID and change it to 3011. Look at changes at /etc/passwd
4- Working on terminal. Add clot2014's user to alumnes11 group. Look at changes at /etc/group
5- Working on terminal. Swap clot2014's default group to adm group. Look at changes at /etc/passwd
6- Working on terminal. Modify alumnes11's GID and change it to 311 . Look at changes at /etc/group
7- Remove clot2014's user. Look at changes at /etc/passwd and
/etc/shadow
8- Remove alumnes11's group. Look at changes at /etc/group
9- Try to remove users group. What is happening?. Why?
10- From GUI repeat exercise 1.
11- From GUI repeat exercise 2.
12- From GUI repeat exercise 3.
13- From GUI repeat exercise 4.
14- From GUI repeat exercise 5.
15- From GUI repeat exercise 6.
16- From GUI repeat exercise 7.
17- From GUI repeat exercise 8.
18- Working with Users and Groups GUI utility. Disable the fje user account. Try to gain access to the fje account. What's is happennig?.
19- Working with Users and Groups GUI utility. Enable the fje user account again. Try to gain access to the fje account. What's is happennig now?.
20- Working on terminal. Disable the fje user account. Help: http://www.cyberciti.biz/faq/linux-disable-user-account-command/
21- Working on terminal. Enable the fje user account again. Help: Work with -U instead of -L and set EXPIRE_DATE to 99999.