TD Managing Users and Groups
Q1. Sometimes instructions say that I must “be root.” What does this mean?
Have root privileges
Q2. What is the root account and how does it differ from a user account?
Root account: system administrator, default user when installing linux, have more permissions than the normal user
Q3. Why would I want to add other user accounts to my system?
There are other users who use my system, so for each user we create an account
Q4. How do I delete users?
Using $ sudo userdel…. or # userdel….
Q5. Is there any way to change a user ID?
Using $ sudo usermod –u username UID
Q6. Is there a way to disable a user account?
Using the expiration date: -e option
Q7. How do I add or change personal information in an account?
Add: using –c (to add comments) root
Modify: usermod with options root
Q8. How do I change a password?
using # Passwd account_name
Exercise 1
1. Create some users stageY and totox giving passwords stageypass and totoxpss
# useradd stagey
Enter password: stageypass
Comfirm password: stageypass
or
# useradd stagey
#passwd stagey
Enter password: stageypass
Comfirm password: stageypass
# useradd totox
Enter password: totoxpss
Comfirm password: totoxpss
or
# useradd totox
#passwd stagey
Enter password: totoxpss
Comfirm password: totoxpss
2. Audits: an immediate opportunity to log in these accounts, setting up their pers. Folder in / home.
Yes we can,
If there is pers. Folder in / home:
# ls / home or #cd / home / home # ls
3. Try to create an existing account.
You cannot create an existing account
4. Delete without regret on behalf of totox. His pers. Folder was removed?
# userdel totox His pers folder deleted: no
# userdel –r totox His pers folder deleted: yes
Exercise 2
It is about creating a group named trainee whose members are the accounts stageX.
As root :
1. create the trainee group
add some accounts stageX, toto1, toto3 , toto3 in this group
$ sudo groupadd trainee or # groupadd trainee
$ sudo useradd –g trainee stagex, toto1, toto2, toto3 stagex, toto1, toto2, toto3: not already created
If these accounts exist: $ sudo usermod –g trainee stagex, toto1, toto2, toto3
2. check the result with the command groups
$ sudo groups
List of groups
$ sudo groups toto1
Trainee
Exercise 3
What does the following commands:
- # Useradd Fadi create a user called Fadi
- # Useradd-e 19-9-2010 fadi create a user fadi with expiration date 19-9-2010
- # Useradd-g fadihome fadi create a user called fadi in a group called fadihome
- # Useradd-g grit -d touficf Toufic Create a user called toufic with a personal directory touficf in a group called
grit
- # Useradd-c "Bernard's Account"-d / home / .bernard -e "2003-08-31" create a user bernard with a bernard
pers directory in / home with comment "Bernard’s Account" and with expiration date
- # Userdel bernard delete a user bernard
- # Userdel-r bernard delete a bernard user with pers folder
- # Usermod tony Paschal change the name of a user
- # Usermod-G root, staff, operator-e 2013-12-31 pascal add the user pascal to the root, staff, operator
secondary groups with an expiration date 2013-12-31
- # Groupadd-g 666 gnu create a group gnu with pid 666
- # groupmod –g 667 gnu modify group pid gnu to be 667
- # Groupdel gnu delete a group
- # Usermod-d pascalfol Pascal modify the pers folder . from pascal to be pascalfol
- # Usermod-d-m pascalfol Pascal modify the pers folder. of pascal to be pascalfol with moving of data from
the old personal folder to new one
- # Usermod-l Pascal disable pascal's password (lock)
- # Usermod-u Pascal activate pascal's password (unlock)
Exercise 4
What do the commands in / etc / sudoers:
- Kamal host1 = / sbin / shutdown kamal can launch shutdown on host1
- Kamil ALL = ALL as root but it cannot remove or modify root privileges.