Chapter 10 Flashcards

Administering Users and Groups

1
Q

Describe the players in managing user accounts. 

A

The /etc/login.defs and /etc/default/useradd files configure various settings for the useradd command’s default behavior. Because the directive settings within these files vary from distribution to distribution, it is wise to peruse them prior to employing the useradd utility to create accounts. When an account is created, the /etc/passwd, /etc/shadow, and /etc/group files are all modified. Depending on the user account creation configuration, a user home directory may be created and files copied to it from the /etc/skel directory.

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

Summarize managing groups. 

A

The commands involved in creating, modifying, and deleting groups are the groupadd, groupmod, and groupdel commands. These commands cause modifications to the /etc/group file. If you need to add a user to a group, you need to employ the usermod utility. A user can easily switch from the account’s default group to another group in which the account is a member by using the newgrp program. Account group membership can be audited via the groups and getent commands as well as by viewing the /etc/group file.

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

Outline the environment files. 

A

The Bash shell uses environment variables to store information about the shell session and the working environment. These variables are set using environment files. Which environment files are run depends on how a user is logging into a system as well as the distribution the account is on. User environment files are hidden files in that they begin with a dot (.) and are potentially the .bash_profile, .bash_login, .profile, and .bashrc files. Global files may include /etc/bashrc, /etc/bash.bashrc, /etc/profile, and files within the /etc/profile.d/ directory.

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

Explain the various methods to query user account information. 

A

There are several utilities you can employ to determine user account information for users who are currently logged into their accounts as well as those who are not. The “who” commands have three variations, which are the whoami, who, and w utilities. The id program is useful for matching UID and GID numbers to particular user accounts. The last command is helpful for viewing not only when a system has rebooted but also whether or not a user is currently logged into the system or when the last time the account was accessed.

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

Describe how to manage filesystem usage quotas. 

A

Prior to setting user account or group quota limits on a system, you must enable quotas on the filesystem using the usrquota and grpquota options in the /etc/fstab file. Once the filesystem is unmounted and then remounted, you can create the needed user and/or group files with the quotacheck utility. After that is accomplished, user or group limits are set with the edquota command. You can also view and/or verify quotas using the repquota program.

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

Which of the following are fields within an /etc/passwd file record? (Choose all that apply.)

User account's username
Password
Password change date
Special flag
UID
A

A, B, E. The user account’s username, password (though it typically only contains an x), and UID are all legitimate fields in an /etc/passwd file record. Therefore, options A, B, and E are correct answers. The password change date and special flag are fields in the /etc/shadow file. Thus, options C and D are incorrect choices.

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

Which of the following are fields in an /etc/shadow file record? (Choose all that apply.)

Password expiration date
Account expiration date
Password
Comment
Default shell
A

A, B, C. The password expiration date, account expiration date, and password are all legitimate fields in a /etc/shadow file record. Therefore, options A, B, and C are correct answers. The comment and default shell are fields in the /etc/passwd file. Thus, options D and E are incorrect choices.

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

Which field contains the same data for both an /etc/passwd and an /etc/shadow file record?

Password
Account expiration date
UID
GID
User account's username
A

E. The user account’s username is the only field within an /etc/passwd and an /etc/shadow record that contains the same data. Therefore, option E is the correct answer. While both files have a password field, they do not contain the same data. The password can only exist in one of the two files, preferably the /etc/shadow file. Thus, option A is a wrong answer. The account expiration date only exists in the /etc/shadow file, so option B is also a wrong choice. The UID and GID fields only exist in the /etc/passwd file, so options C and D are also incorrect answers.

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

Which of the following commands will allow you to view the NUhura account’s record data in the /etc/passwd file? (Choose all that apply.)

getent NUhura passwd
cat /etc/passwd
passwd NUhura
grep NUhura /etc/passwd
getent passwd NUhura
A

B, D, E. Though not very efficient, the cat /etc/passwd command would allow you to view the NUhura account’s record within the /etc/passwd file. The grep NUhura /etc/passwd and getent passwd NUhura commands also would allow you to see the NUhura record. So options B, D, and E are correct choices. The getent command in option A has got the username and filename flip-flopped, so it is an incorrect choice. Also, the passwd NUhura command attempts to change the account’s password instead of display its file record, so option C is also an incorrect answer.

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

You use the useradd -D command to view account creation configuration directives. What file does this command pull its displayed information from?

The /etc/passwd file
The /etc/shadow file
The /etc/group file
The /etc/login.defs file
The /etc/default/useradd file
A

E. The useradd -D command allows you to view the account creation configuration directives in the /etc/default/useradd file. Therefore, option E is the correct answer. The /etc/passwd, /etc/shadow, and /etc/group files do not contain account creation configuration directives, so options A, B, and C are wrong answers. While the /etc/login.defs file does contain account creation configuration directives, you cannot display it with the useradd -D command. Therefore, option D is also an incorrect choice.

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

You create an account using the appropriate utility, except for some reason the account’s home directory was not created. Which of the following most likely caused this to occur?

The HOME directive is set to no.
You did not employ super user privileges.
The CREATE_HOME directive is not set.
The INACTIVE directive is set to -1.
The EXPIRE date is set and it is before today.
A

C. If the CREATE_HOME directive is not set or it is set to no, when a user account is created no home directory will be created by default. Most likely this caused the problem, so option C is the correct answer. The HOME directive determines what base directory name is used when creating home directories for new accounts, so option A is a wrong answer. If you did not employ super user privileges, you would not have been able to even create the account, so option B is a wrong choice. The INACTIVE directive pertains to when an account will be considered inactive, so option D is also an incorrect answer. The EXPIRE directive is involved with account expiration and not home directory creation. Therefore, option E is also an incorrect choice.

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

Your boss has asked you to remove KSingh’s account and all his home directory files from the system immediately. Which command should you use?

usermod -r KSingh
rm -r /home/KSingh
userdel Ksingh
userdel -r KSingh
usermod -d KSingh
A

D. To immediately remove the KSingh account and all his home directory files, using super user privileges you would use the userdel -r KSingh command. Therefore, option D is the correct answer. There is no -r option for the usermod command, so option A is a wrong answer. The rm -r /home/KSingh command would only remove the account’s home directory files and not delete the user account. Therefore, option B is an incorrect answer. The userdel command without any options would only delete the account and not remove any of its home directory files, so option C is a wrong choice. The -d option on the usermod command is for changing an account’s home directory. Therefore, option E is also an incorrect choice.

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

Which of the following will allow you to change an account’s /etc/shadow file record data? (Choose all that apply.)

The passwd command
The usermod command
The userdel command
The getent command
The chage command
A

A, B, C, E. The passwd, usermod, userdel, and chage commands can all manipulate (or remove) an account’s /etc/shadow file record data in some way. Therefore, options A, B, C, and E are all correct. While the getent command will allow you to display selected records from the /etc/shadow file, it will not allow you to manipulate data records within the file. Therefore, option D is the only incorrect choice.

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

Which of the following commands will allow you to switch temporarily from your account’s default group to another group you are a member of?

The usermod command
The newgrp command
The groups command
The groupadd command
The groupmod command
A

B. The newgrp command will let you switch temporarily from your account’s default group to another group with whom you have membership. Therefore, option B is the correct answer. The usermod command could make that switch, but it is not best for temporary situations, so it is an incorrect choice. The groups command allows you to display group information, but not change groups, so it also is a wrong answer. The groupadd and groupmod commands deal with group management, but not temporarily switching an account’s default group. Therefore, options D and E are also incorrect choices.

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

Which of the following commands is the best one to add JKirk as a member to a new group called the NCC-1701 group and not remove any of the account’s previous group memberships?

usermod -g NCC-1701 JKirk
usermod -G NCC-1701 JKirk
usermod -aG NCC-1701 JKirk
groupadd NCC-1701
groupmod NCC-1701 JKirk
A

C. The usermod -aG NCC-1701 JKirk command would add JKirk to the NCC-1701 group as a member and not remove any of the account’s previous group memberships. Therefore, option C is the correct answer. The usermod -g NCC-1701 JKirk command would change the JKirk account’s primary group membership, so option A is a wrong answer. The command in option B would add the JKirk account as a member to the NCC-1701 group, but it would remove any of the account’s previous group memberships. Thus, option B is an incorrect answer. The groupadd NCC-1701 command would only add the NCC-1701 group. Therefore, option D is a wrong answer as well. The groupmod command is for modifying groups, and so the command in option E would have undesirable results. Thus, option E is an incorrect choice.

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

Which of the following commands could be used to view the members of the NCC-1701 group? (Choose all that apply.)

groups NCC-1701
getent group NCC-1701
getent groups NCC-1701
grep NCC-1701 /etc/group
grep NCC-1701 /etc/groups
A

B, D. The getent group NCC-1701 and grep NCC-1701 /etc/group commands would both allow you to see the various NCC-1701 group members. Therefore, options B and D are correct answers. The groups command is for viewing an account’s various group memberships. Therefore, option A is a wrong answer. It is always tempting to add an s to the /etc/group filename, because of the groups command. However, it is the group file and not the groups file. Thus, options C and E are incorrect choices.

17
Q

User environment files typically come from where?

/etc/skel
/home/ userid
$HOME
~
/etc/
A

A. The skeleton directory, /etc/skel, typically contains the user environment files that are copied to the account’s home directory when it is created. Therefore, option A is the correct answer. Options B, C, and D all contain references to home (or potential home) directories. That is where the user environment files end up, but not where they come from. Thus options B, C, and D are wrong answers. The /etc/ directory is where the global environment files reside. Therefore, option E is also an incorrect choice.

18
Q

A user has logged into the tty3 terminal. Which of the following user environment files is executed first if found in the user’s home directory?

The .bash_login file
The .bashrc file
The .profile file
The .bash.bashrc file
The .bash_profile file
A

E. The .bash_profile user environment file is run first if it is found in the user account’s home directory. Therefore, option E is the right answer. The .bash_login and .profile user environment files would be ignored if they existed alongside the .bash_profile file within the user’s home directory. Thus, options A and C are wrong answers. The .bashrc file is typically called to execute from one of the other user environment files for an interactive login session. Thus, option B is also an incorrect answer. The .bash.bashrc file, though similar in name to a global environment file, does not exist. Therefore, option D is an incorrect choice.

19
Q

Which of the following files and directories may be involved in setting up the environment for all system users? (Choose all that apply.)

/etc/bash_profile/
/etc/profile
/etc/profile.d/
/etc/bashrc
/etc/bash.bashrc
A

B, C, D, E. Depending on the Linux distribution currently in use, the files (and directory) in options B, C, D, and E may be involved in setting up the global environment. The directory in option A, while similar to a user environment filename, is made up. Therefore, option A is the only incorrect choice.

20
Q

Which of the following commands displays information about the account issuing the command? (Choose all that apply.)

whoami
who am i
cat $HOME/.bashrc
cat $HOME/.profile
id
A

A, B, E. The whoami, who am i, and id commands will all display information about the current account that is issuing the commands. Therefore, options A, B, and E are correct answers. While the cat commands may display user environment files in the account’s home directory, they do not display information concerning the account. Thus, options C and D are incorrect choices.

21
Q

Which of the following commands will display CPU load data along with information concerning users who are currently logged into the system?

The who command
The id command
The whoami command
The w command
The last command
A

D. The w command displays CPU load information for the last 1, 5, and 15 minutes as well as data about users who are currently accessing the system. Therefore, option D is the correct answer. The who command will display information concerning users who are currently logged into the system, but not CPU load data. Thus, option A is a wrong answer. The id command displays user account information, not CPU load data or active user info. Therefore, option B is also a wrong choice. The whoami command only displays the username of the current user issuing the command. Thus, option C is an incorrect answer. The last command displays past and present system access information for user accounts but nothing concerning CPU load data. Thus, option E is an incorrect choice.

22
Q

The last command, by default, pulls its data from what file?

The /var/run/utmp file
The /var/log/wtmp file
The /var/log/wtmp.1 file
The /etc/shadow file
The /etc/passwd file
A

B. The last command by default pulls its data from the /var/log/wtmp file. Therefore, option B is the correct answer. The w command uses data from the /var/run/utmp file, so option A is a wrong choice. The last command can pull information from an older saved wtmp file, such as /var/log/wtmp.1, but it does not do so by default. Thus, option C is a wrong choice. The /etc/shadow and /etc/passwd files do not contain any data that can be used with the last command. Therefore, options D and E are incorrect answers.

23
Q

Which of the following are options used in the /etc/fstab file to designate a filesystem as one that uses quotas? (Choose all that apply.)

usrquota
quotaon
grpquota
quotacheck
aquota.user
A

A, C. The usrquota and grpquota options are /etc/fstab settings used to enable user and group quotas for a filesystem. Therefore, options A and C are correct answers. Options B and D contain commands that are used with managing filesystem quotas. Thus, options B and D are wrong answers. The aquota.user is a file that is created when the quotacheck -cu command is employed. Therefore, option E is an incorrect choice.

24
Q

A problem has occurred concerning group quotas on three filesystems. You need to quickly remove all filesystems’ quota limits to temporarily resolve this issue. What is the best command to employ?

vi /etc/fstab
quotaoff -a
quotacheck -cg
quotacheck -cu
umount
A

B. To quickly remove quota limits on all filesystems, you would use the quotaoff -a command. Therefore, option B is the correct answer. Editing the /etc/fstab would take too long because you would have to remove the quota options and then unmount and remount all the filesystems. Thus, option A is a wrong answer. The quotacheck utility creates either the aquota.group file, if the -cg options are used, or the aquota.user file, if the -cu switches are used, or both files if -cug is employed. However, it does nothing for quickly turning off filesystems’ quotas. Thus, options C and D are incorrect answers. The umount command will not turn off filesystems’ quotas, and therefore option E is also an incorrect choice.

25
Q

You need to edit quota grace periods. Which of the following commands should you use?

edquota -u
edquota -g
edquota -t
edquota -G
edquota --grace
A

C. The edquota -t command will edit quota grace periods. Therefore, option C is the right answer. The edquota -u command edits a designated user’s quota limits. Thus, option A is a wrong answer. The edquota -g command edits a designated group’s quota limits. Therefore, option B is also an incorrect answer. The edquota -G command and edquota –grace command are made up. Thus, both options D and E are incorrect choices.

26
Q
A