User and Group Management Flashcards

1
Q

How can you add a user using the command?

A

useradd username or adduser username

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to create the user manually?

A

there are seven steps to creating a user manually:
1. Backup /etc/passwd, /etc/group, /etc/shadow.
2. Make entries in /etc/passwd and /etc/group respectively through vi or vim editor.
3. Create a home directory for the new user. mkdir /home/user
4. Change the permissions of the home directory to 700. chmod 700 /home/user
5. Copy the environmental files to the new home directory. cp /etc/skel/.* /home/user
6. Change the ownership of the home directory. chown user:user /home/user
7. Set password for the new user and test the login. passwd user then su - user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What files are modified while you create a user?

A

/etc/passwd for user information,
/etc/group for group information and /etc/shadow contains encrypted passwords

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If you want to create a user manually on your local machine, in which file will you define
the user?

A

/etc/passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name the fields of the /etc/passwd file.

A

username:password:UID:GID:comments:home
directory:shell

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you get the ID number of a user and the username?

A

id username, cat /etc/passwd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What would happen if UID "0" is assigned to the user "marshal"?

A

security measures will be
bypassed for marshal, and the user marshal will have root level privileges since the UID 0 is reserved
for root. Audit trails, recovery difficulties, system security and integrity, security risks, accidental
system changes, user privileges, package management, elevated privileges.
Granting root-level access to another user should only be done under exceptional circumstances and
with a clear understanding of the potential consequences. If you need to provide administrative
access to other users, it's better to use mechanisms like sudo, which allow users to execute specific
commands with elevated privileges while maintaining a separation of privileges.

marshal will have root privileges.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a Primary group vs. Supplementary/secondary group?

A

Primary is automatically assigned upon user creation with useradd. To change primary group usermod -g <groupname> <user>.</user></groupname>

Secondary group is attached later to manage accessibility to certain directories that may have SGID. To append secondary Group, use: usermod -aG <secondary> <user></user></secondary>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the importance of "skel" files (found under /etc/skel)?

A

create default settings in a
new user’s home directory, has the environmental and initialization files.

environmental files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How would you check if there were any errors in /etc/password and /etc/group files?

A

pwck to check /etc/passwd, grpck to check /etc/group

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How would you lock/unlock a user account, and what are some hints to know if one's account is locked or not?

A

“usermod -L username to lock, usermod -U username to unlock.

We can also use passwd -l username to lock and passwd -u username to unlock.

In /etc/shadow, a locked account will have a !! infront of the second (password) column if passwd -l is used, but only a single ! in front of the second (password) column if usermod -L is used.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can we create a group called "prod"?

A

groupadd prod

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to make the user "max" a part of the "prod" group?

A

usermod -aG prod max.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly