Linux + Ch. 10 Administering Users and Groups
3. Which field contains the same data for both a /etc/passwd and /etc/shadow file record? A. Password B. Account expiration date C. UID D. GID E. User account's username
A, E, The username is the only field within a /etc/passwd and /etc/shadow record that contains the same data.
10. 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? A. usermod -g NCC-1701 JKirk B. usermod -G NCC-1701 JKirk C. usermod -aG NCC-1701 JKirk D. groupadd NCC-1701 E. groupmod NCC-1701 JKirk
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.
16. Which of the following commands will display CPU load data along with information concerning users who are currently logged into the system? A. The who command B. The id command C. The whoami command D. The w command E. The last command
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.
8. Which of the following will allow you to change an account's /etc/shadow file record data? (Choose all that apply.) A. The passwd command B. The usermod command C. The userdel command D. The getent command E. The chage command
A B C E The passwd, userdel, and chage commands can all manipulate (or remove) an account's /etc/shadow file record data in some way.
2. Which of the following are fields within a /etc/shadow file record? (Choose all that apply.) A. Password expiration date B. Account expiration date C. Password D. Comment E. Default shell
A B C. The password expiration date, account expiration date, and password are all legitimate fields within a /etc/shadow file record.
15. Which of the following commands displays information about the account issuing the command? (Choose all that apply.) A. whoami B. who am i C. cat $HOME/.bashrc D. cat $HOME/.profile E. id
A B E The whoami, who am i and id commands will all display information about the current account that is issuing the commands.
1. Which of the following are fields within a /etc/passwd file record? (Choose all that apply.) A. User account's username B. Password C. Password change date D. Special flag E. UID
A B E. The user account's username, password (though it typically only contains an x), and UID are all legitimate fields within a /etc/password file record.
18. 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.) A. usrquota B. quotaon C. grpquota D. quotacheck E. aquota.user
A. C. The usrquota and grpquota are /etc/fstab settings used to enable user and group quotas for a filesystem.
12. User environment files typically come from where? A. /etc/skel/ B. /home/userid C. $HOME D. ~ E. /etc/
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.
11. Which of the following could be used to view the members of the NCC-1701 group? (Choose all that apply.) A. groups NCC-1701 B. getent group NCC-1701 C. getent groups NCC-1701 D. grep NCC-1701 /etc/group E. grep NCC-1701 /etc/groups
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.
14. Which of the following files and directories may be involved in setting up the environment for all system users? (Choose all that apply.) A. /etc/bash_profile/ B. /etc/profile C. /etc/profile.d/ D. /etc/bashrc E. /etc/bash.bashrc
B. C. D. E.
4. 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.) A. getent NUhura passwdg B. cat /etc/passwd C. passwd NUhura D. grep NUhura /etc/passwd E. getent passwd NUhura
B. D. E. Though not very efficient, the cat /etc/passwd command would allow you to view the NUhura account's records within the /etc/passwd file. The grep HUhura /etc/ passwd and getent passwd NUhura commands also would allow you to see the NUhura record.
17. The last command, by default, pulls its data from what file? A. The /var/run/utmp file B. The /var/log/wtmp file C. The /var/log/wtmp.1 file D. The /etc/shadow file E. The /etc/passwd file
B. The last command by default pulls its data from the /var/log/wtmp file. Therefore, option B is the correct answer.
9. Which of the following commands will allow you to switch temporarily from your account's default group to another group with whom you have membership? A. The usermod command B. The newgrp command C. The groups command D. The groupadd command E. The groupmod command
B. The newgrp command will let you switch temporarily from your account's default group to another group with whom you have membership.
19. 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? A. vi /etc/fstab B. quotaoff -a C. quotacheck -cg D. quotacheck -cu E. umount
B. To quickly remove quota limits on all filesystems, you would use the quotaoff -a command.
6. 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? A. The HOME directive is set to no. B. You did not employ super user privileges. C. The CREATE_HOME directive is not set. D. The INACTIVE directive is set to -1. E. The EXPIRE date is set and it is before today.
C. If the CREATE_HOME directive is not set or it is set to no, then when a user account is created, no home directory will be created by default.
20. You need to edit quota grace periods. Which of the following commands should you use? A. edquota -u B. edquota -g C. edquota -t D. edquota -G E. edquota --grace
C. The edquota -t command will edit quota grace periods.
7. 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? A. usermod -r KSingh B. rm -r /home/KSingh C. userdel Ksingh D. userdel -r KSingh E. usermod -d KSingh
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.
13. 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? A. The .bash_login file B. The .bashrc file C. The .profile file D. The .bash.bashrc file E. The .bash_profile file
E. The bash_profile user environment file is run first if it is found in the user account's home directory.
5. You use the useradd -D command to view account creation configuration directives. What file does this command pull its displayed information from? A. The /etc/passwd file B. The /etc/shadow file C. The /etc/group file D. The /etc/login.defs file E. The /etc/default/useradd file
E. The useradd -D command allows you to view the account creation configuration directives within the /etc/default/useradd file.
Describe how to manage usage quotas.
Prior to setting user account or group quota limits on a system, you must enable quotas on the file system via the usrquota and grpquota options within the /etc/fstab file. Once the filesystem is unmounted and then remounted, you can create the needed user and/or group files via the edquota command. You can also view and/or verify quotas via the repquota program.
Outline the environment files.
The Bash shell uses environment variables to store information about the shell session and the working environment. These variables are set via environment files. Which environment files are run depends upon 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 the files within the /etc/profile.d/ directory.
Summarize managing groups.
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 of the newgrp program. Account group membership can be audited via the groups and getent commands as well as by viewing the /etc/group file.
Explain the various methods to query user account information.
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 a system the last time the account was accessed.