0% found this document useful (0 votes)
16 views4 pages

TD1 Managment Users and Groups

The document provides a comprehensive guide on managing users and groups in a system, detailing commands for creating, modifying, and deleting user accounts and groups. It explains the significance of the root account and includes exercises for practical application of user management commands. Additionally, it covers the use of sudo for executing commands with root privileges and the configuration of the sudoers file.

Uploaded by

Hussein assaad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

TD1 Managment Users and Groups

The document provides a comprehensive guide on managing users and groups in a system, detailing commands for creating, modifying, and deleting user accounts and groups. It explains the significance of the root account and includes exercises for practical application of user management commands. Additionally, it covers the use of sudo for executing commands with root privileges and the configuration of the sudoers file.

Uploaded by

Hussein assaad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TD Managing Users and Groups

Q1. Sometimes instructions say that I must “be root.” What does this mean?
Q2. What is the root account and how does it differ from a user account?
Q3. Why would I want to add other user accounts to my system?
Q4. How do I delete users?
Q5. Is there any way to change a user ID?
Q6. Is there a way to disable a user account?
Q7. How do I add or change personal information in an account?
Q8. How do I change a password?

Exercise 1

1. Create some users and stageY totox giving passwords and stageypass totoxpss
2. Audits: an immediate opportunity to log in these accounts, setting up their rep. staff / home.
3. Try to create an existing account.
4. Delete without regret on behalf of totox. His rep. staff he was removed?

Exercise 2
It is about creating a group named trainee whose members are the accounts stageX.
As root :

1. create the student group:


add some accounts stageX, foo1, foo2, toto3 in this group
2. check the result with the control groups

Exercise 3
What does the following commands:
- # Useradd Fadi
- # Useradd-e 19-9-2010 fadi
- # Useradd-g fadihome fadi
- # Useradd-g-d touficf grit Toufic
- # Useradd-c "Bernard's Account"-d / home / .bernard-e "2003-08-31"
- # Userdel bernard
- # Userdel-r bernard
- # Usermod tony Paschal
- # Usermod-G root, staff, operator-e 2013-12-31 pascal
- # Groupadd-g 666 gnu
- # 667 gnu-g groupmod
- # Groupdel gnu
- # Usermod-d pascalfol Paschal
- # Usermod-d-m pascalfol Paschal
- # Usermod-l Paschal
- # Usermod-u Paschal

Exercise 4
What do the commands in / etc / sudoers:
- Kamal host1 = / sbin / shutdown
- Kamil ALL = ALL
The main orders

useradd, usermod, userdel user account management


groupadd, groupmod, groupdel group management
pwck, grpck file verification
passwd change the password of a user
chfn, id, groups, finger Misc

Options:
-U uid to set uid
-G group-primary
fixed membership user to a list
G-list
secondary groups (separator, no spaces)
-S shell default award of default shell bash
-C comment
-D dir. staff default in the directory / home
E-expiration-date fixed expiration date of the account (MM / DD / YY)
-M to create the directory
K skel-dir- copies the contents of the rep-skel dir. personnel, by default / etc / skel

SUDO
sudo allows you to run programs with root privileges. We can therefore give permission to a user or group of users
to run programs with root privileges (for exam halt or reboot), in the case of a server with multiple users this can be
handy.
You can also use sudo, if it was just too lazy to raise its rights with su.

sudo is installed by default on Ubuntu.

/ Etc / sudoers

The sudo configuration is done from the file / Etc / sudoers


Its edition is through the command visudo which is in fact an improved text editor for sudo (like crontab).
To create the user stageX, Root passes the command:
useradd stageX
This creates:

o home directory / Home / stageX, With the default account name


o a new entry in two basic file / etc / passwd and / etc / group.
o To know Options useradd (required to manage accounts by using scripts)
 To assign a password:
passwd stageX
enter 2 times stgx
 Delete a user account (not connected) at random .. totox.
userdel [-r] totox
Option -R also removes the dir. staff and user files
The command removes all traces of the user in the configuration file: / Etc / passwd including groups of
users only.
 Change the user account foo
usermod [options] totox
The options are the same that useradd
usermod-G student, teacher stageX stageX added in the 2 groups and trainee teachers (which must
exist)

First form of the useradd command: Summoned in this way, the command creates a new
user account using the values specified (on the command line) and values
system default if the options are not specified. Depending on the options chosen, the new account
will be created and files will be copied in its original workspace.

SYNOPSIS:
useradd-c comment-d homedir expire_date-e-f-g inactive_date initial_group -
-G group,-m-k-p skel_dir passwd-u uid-s shell-ologin
EXAMPLE: add a user.
tux: / # useradd-c "Bernard's Account"-d / home / .bernard-e "2003-08-31" - -

- # Usermod-d pascalfol Paschal


we change the home directory of a Paschal pascalfol

- # Usermod-d-m pascalfol Paschal


is changing and moving the home directory of Easter to pascalfol (copy information)

- # Usermod-l Paschal
deactivate the password for Easter

- # Usermod-u Paschal
Enable password for Easter

usermod usermod command to modify the characteristics of a user.

SYNOPSIS:
usermod-c comment-d homedir-me expire_date inactive_date-f-g -
initial_group-group G,-l loginname-p passwd-u uid-s shell-ol-Ulogin
Example: Add user in the operator group Paschal
(It is already member of the main root gnu and groups and staff)
and he set an expiration date to 31.12.2013:
tux: / # usermod-G root, staff, operator-e 2013-12-31 pascal

userdel The command userdel removes a user account (if any). Option -R allows
in addition to the removal of the contents of the directory and debit of the user, and its
mail directory.
SYNOPSIS:
userdel-rlogin
Example: Remove an undefined users
tux: / # userdel-r bernard

groupadd The command groupadd creates a new group.


SYNOPSIS:
groupadd-g gid-ologin
EXAMPLE: Add Group
tux: / # groupadd-g 666 gnu
groupmod The command groupmod can change the group settings.
SYNOPSIS:
groupmod-g gid-o-n group_namegroup
EXAMPLE: Modfier gid group gnu.
tux: / # groupmod 667 gnu-g
groupdel The command groupdel, Takes a group (if any).
SYNOPSIS:
groupdelgroup
Example: Remove the group gnu.
tux: / # groupdel gnu

You might also like