Chapter 3
Chapter 3
I/ Introduction:
In this chapter, we'll see how the Linux system manages groups and users, and the commands
needed to operate on both concepts.
Unix user = accounts + groups
An account allows you to use a computer Log in, work, log out
There are 3 types:
Administrator: only one possible, qualified as superuser, his account name is root. Some systems
prevent direct connection to this account, as it has full rights.
System accounts: associated with certain services, e.g., printer, network... Generally, not
connectable
Ordinary users
Note: the Unix system is case-sensitive. Most Unix commands are written in lower case.
sudo ls /root
[sudo] password for user
Files Description
cat /etc/passwd
cat /etc/group
• The --gid GID option is used to force the group identifier to a certain value.
• Adding the --system option creates a system group
Note that changing the GID does not update the files and folders assigned to the group => there will be
an anomaly, as these files will have no known group.
4/ group deleting:
delgroup is a command that delete a specific group
delgroup nom
The command is refused if there are users for whom this is the main group.
cat /etc/shadow
id -g ing
4/ Account modification:
The usermod command changes what you want with the options :
-C We can add a comment field for the UserAccount
5/ Password change:
The passwd command is used to change the password
• passwd (no parameters): changes for the user issuing the command
• sudo passwd nomuti: changes this user's password
6/ Deleting account:
The deluser command is used to delete an account:
deluser --remove-all-files nom
Without the option, the command does not delete files owned by this user
7/ Account login:
You can log in to any account (except root on Debian) during system startup.
Once logged in, you can change account using the su command
su : (without parameters) logs in as root
• su user: log in as this user, but remain in the current folder
Chapter III: Opening and closing session 5 Dr. Saadi Leila
Batna 2 university Mathematics and computer science faculty
Computer science department Computer Engineer 1st year 2023-2024
Introduction of operating systems
• su - user: log in and go to this user's account
8/ Find out which account:
• The whoami command displays the name of the account in which you are working.
• The who command lists users connected to the same system
R W X
G Yes No Yes
O No No Yes
Example:
The file exp2.txt belongs to ing, and is placed in the section1 group.
Exp2.txt R W X
G Yes No Yes
O No No Yes
Rights viewing
The ls -l command displays the rights table just after the file type
• 3 triplets of 3 letters, for U, for G and for O
1 letter = right granted, - = right denied
• File owner and group name
Example:
rwxrwxr-x 5 leila admin 4096 nov. 25 bin
-rw-r--r-- 1 leila admin 223 août 15 infos
-rwxr-x--x 2 leila Ing 4096 nov. 13 chk