Chapter 6 - User and Group Management Flashcards

1
Q

Which command to use to get information about a user account?

A

id

Example: id linda

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

What are the various ways to run tasks with elevated permissions?

A

Method Description

  1. su = Opens a subshell as a different user, with the advantage that commands are executed as root only in the subshell
  2. sudo = Enables you to set up an environment where specific tasks are executed with administrative privileges
  3. PolicyKit = Enables you to set up graphical utilities to run with administrative privileges
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between “su -“ and just “su”?

A

When you use “su” from a shell, The subshell that is started when using su is an environment where you are able to work as the target user account, but environment settings for that user account have not been set.

If you need complete access to the entire environment of the target user account, you can use su - to start a login shell. If you start a login shell, all scripts that make up the user environment are processed, which makes you work in an environment that is exactly the same as when logging in as that user.

Using su - is better than using su. When the - is used, a login shell is started; without the -, some variables may not be set correctly

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

How to assign administrative persmissions to a user only for running specific commands?

A

sudo
the system administrator can configure sudo to
give that user administrator permissions to perform the specific task.
use “visudo” to edit the sudoers configuration file and give user access to specific commands only

For example, if you would include the line linda
ALL=/usr/bin/useradd, /usr/bin/passwd in this file, that would allow user linda to run only the commands useradd and passwd with administrative privileges

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

What is policykit?

A

Most administration programs with a graphical user interface use PolicyKit to authenticate as the root user.

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

What command to create a user laura who is a member of the group wheel

A

useradd -G wheel laura

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

What are the two types of user accounts in Linux?

A

System Accounts and Normal Accounts

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

What is a Normal account in Linux?

A

normal user accounts for the people who need to work on a server and who need limited access to the resources on that server

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

What is a system account in Linux?

A

system accounts that are used by the services the server is offering.

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

In which directory or configuration files are the properties of the user accounts saved?

A

/etc/passwd

/etc/shadow

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

What are the different fields in the /etc/passwd file?

A
Username
Password
UID
GID
Comment field
Directory
Shell
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the file /etc/shadow used for?

A

One part of the user configuration is stored in the /etc/passwd file and another part of the user configuration is stored in the file /etc/shadow. The settings in this file are used to set properties of the password. Only the user root and processes running as root have access to /etc/shadow

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

What are the various fields in the /etc/shadow file?

A
  1. Login name
  2. Encrypted password
  3. Days since Jan. 1, 1970, that the password was last changed
  4. Days before password may be changed
  5. Days after which password must be changed
  6. Days before password is to expire that user is warned
  7. Days after password expires that account is disabled
  8. Days since Jan. 1, 1970, that account is disabled
  9. A reserved field, which was once added “for future use”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the commands that can be used to manage password properties?

A

passwd or chage

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

What is the command to edit the contents of the /etc/passwd and /etc/shadow configuration files directly?

A

vipw

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

What are the different ways of creating or adding new users in linux?

A

vipw –> used to directly edit the contents of passwd or shadow file
useradd command

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

Which command can be used to delete a user?

A

userdel

18
Q

Which command can be used to delete a user and his/her complete environment?

A

userdel -r

19
Q

In which directory are the properties of the group defined?

A

/etc/group

20
Q

Which command can be used to edit the contents of the file /etc/group

A

vigr

21
Q

What is the most common utility in Linux for managing users?

A

useradd

Example : useradd -m -u 1201 -G sales,ops linda

to create a user linda who is a member of the secondary groups sales and ops with
UID 1201 and add a home directory to the user account as well

22
Q

What is the command-line utility for modifying user properties?

A

usermod

23
Q

What is the one thing that usermod does not do well or for which usermod is not preferrable to be used?

A

setting passwords. If as root you want to change the user password, you’d use the passwd command

24
Q

When using useradd command some default values are assumed, where are these default values taken from , which file are these default values stored in?

A

/etc/login.defs

/etc/default/useradd

25
Q

List some of the properties that can be set from /etc/login.defs

A
MOTD_FILE
ENV_PATH
PASS_MAX_DAYS, PASS_MIN_DAYS, PASS_WARN_AGE
UID_MIN
CREATE_HOME
26
Q

What does the command “passwd -n 30 -w 3 -x 90 linda” do?

A

sets the password for user linda to a minimal usage period of 30 days and an expiry after 90 days, where a warning is generated 3 days before expiry

27
Q

What are the few files that play an important role in constructing the user environment ?

A

/etc/profile
/etc/bashrc
~/.profile
~/.bashrc

28
Q

What. is the purpose of this file /etc/profile

A

Used for default settings for all users when starting a login shell

29
Q

What is the purpose of this file /etc/bashrc

A

Used to define defaults for all users when starting a subshell

30
Q

What is the purpose of this file ~/.profile

A

Specific settings for one user applied when starting a login shell

31
Q

What is the purpose of this file ~/.bashrc

A

Specific settings for one user applied when starting a subshell

32
Q

Which directory is the user’s primary group membership defined?

A

user’s primary membership is stored in /etc/passwd. The group itself is stored in /etc/group configuration file

33
Q

What is primary group and secondary group for users in linux?

A

Every user must be a member of the primary group, and there is only one primary group. When creating files, the primary group becomes group.
Users can be a member of one or more secondary groups as well. A user can be a member of a secondary group in addition to the primary group owner of these files

34
Q

What are the different ways to create a new group?

A

vigr command - this edits the /etc/group file directly

Or you can use the groupadd command

35
Q

What are the fields in the /etc/group file?

A
  1. Group Name
  2. Group Password
  3. Group ID
  4. Members
36
Q

Which option with groupadd command allows you to specify the group id?

A

-g option with groupadd command.

37
Q

Which is the command used to manage the group propoerties?

A

“groupmod” command. This can be used to change the group name or id but it does not allow you to add members to a group

38
Q

Which command allows to add users to a group?

A

usermod
Example : usermod -aG sales linda
This command assigns user linda to group sales

39
Q

Which command can be used to check the groups to which a user is assigned?

A

groupmems

Example : “groupmems -g sales -l” to see which users are a member of the group sales

40
Q

Which command can be used to see the properties of a user?

A

id command

Example : id linda