LPI Linux Essentials 010 V1.6 - Chapter 12 Quiz
You want to run the command cat /etc/shadow as root, but you're logged in as an ordinary user. Which of the following commands will do the job, assuming that the system is configured to give you super user access via the appropriate command? A. sudo cat /etc/shadow B. root cat /etc/shadow C. passwd cat /etc/shadow D. su cat /etc/shadow E. admin cat/etc/shadow
A. The sudo command is the usual way to execute a single command as root, and option A gives the correct syntax to use it as the question specifies. There is no standard root command, so option B is incorrect. The passwd command changes passwords, so option C is incorrect. Although you can use su to execute a single command as root, you must use it with the -c option to do this, as in su -c "cat /etc/shadow", so option D is incorrect. Option E's admin is a fictitious command, so this option is incorrect.
True or false: As a general rule, you should employ extra care when running programs as root.
True. It's possible to do more damage to a computer as root than as an ordinary user. Thus, you should be extra cautious when using root—run only trusted programs, double- check your commands for errors, and so on.
What type of information will you find in /etc/passwd for ordinary user accounts? (Choose all that apply.) A. A user ID (UID) number B. A complete listing of every group to which the user belongs C. The path to the account's home directory D. The path to the account's default GUI desktop environment E. The path to the account's default text-mode shell
A, C, E. The /etc/passwd file's fields specify the username, an encrypted password (or x to denote use of shadow passwords, which is more common), a UID number (option A), a single default GID number, a comment field that normally holds the user's full name, the path to the account's home directory (option C), and the path to the account's default text- mode shell (option E). Option B is incorrect because, although /etc/passwd includes the user's default group, the user may belong to additional groups that are defined elsewhere. Option D is incorrect because the user's default desktop environment is not defined in /etc/ password.
True or false: Linux stores information on its groups in the /etc/groups file.
False. The name for the group data file in Linux is /etc/group, not /etc/groups.
True or false: whoami provides more information than id
False. The whoami command displays your username only. The id command displays your username, your UID number, your primary group name, your primary GID number, and the group names and GID numbers of all your groups.
What is the purpose of the system account with a UID of 0? A. It's the system administration account. B. It's the account for the first ordinary user. C. Nothing; UID 0 is left intentionally undefined. D. It varies from one distribution to another. E.It'salow-privilegeaccount that'susedasadefaultbysomeservers
A. UID 0 is reserved for the system administrator's account, also known as root, so option A is correct. The first ordinary user account is not a system account, and its UID is normally 500 or 1000, depending on the distribution, so option B is incorrect. Because A is correct, C cannot be correct. The association of UID 0 for administrative tasks is very basic in Linux, so you won't find variation on this score, making option D incorrect. Since the root account is not low-privilege, option E is also incorrect.
To learn who is currently logged into the computer and what programs they're currently running, you can type __________. A. who B. w C. whoami D. who -q E. id
B. While the who and the who -q commands will display who is currently logged into the computer, only the w command will also display what programs they are currently running
A _______________ environment means that a person cannot deny actions, and the sudo command helps establish this environment. A. secure B. standard C. nonrepudiation D. repudiation E. locked-down
C. A company policy that demands the sudo command is used to acquire root privileges sets a desirable nonrepudiation environment in which actions cannot be legally denied.
The file that associates usernames with UID numbers in Linux is ___________________ . A. /etc/shadow B. /etc/group C. /etc/UID D. /etc/passwd E. /etc/usernames
D. The /etc/passwd file contains not only user account information such as the username, primary group ID, and default shell, but it also contains the UID associated with each username.
UIDs above 0 and below 500 or 1,000 (depending on the distribution) are reserved for use by ___________________ account(s). A. administrator B. standard user C. unprivileged D. root E.system
E. System accounts have UIDs above 0, but below 500 or even 1,000, depending on the distribution's configuration. The root account typically has a UID of 0.