LPI Linux Essentials
Knowledge Domain Topic 5:
Security and File Permissions
Practice Test Questions #2:
a) C shell
b) Korn shell
c) Bourne Again Shell
d) Z shell
--------------------------
1 Answer Below:
--------------------------
/* --------------------- */
Explanation: While other shells like the C shell, Korn shell, and Z shell may be available on Linux, the default login shell is bash.
1. Answer: c) Bourne Again Shell. The default login shell on most Linux distributions is the Bourne Again Shell, or bash.
2. Which command is used to change the login shell for a user account?
a) chlogin
b) chsh
c) chshl
d) chshell
--------------------------
2 Answer Below:
--------------------------
/* --------------------- */
Explanation: The chsh command is used to change the login shell for a user account on Linux systems. The command runs in interactive mode by default, but can also be run in non-interactive mode using the -s parameter followed by the path to the shell binary.
2. Answer: b) chsh. The chsh command is used to change the login shell for a user account.
3. Which of the following accounts typically does not have a valid login shell?
a) User accounts
b) System accounts
c) Root account
d) Guest accounts
--------------------------
3 Answer Below:
--------------------------
/* --------------------- */
Explanation: System accounts are typically pre-created at system installation time, and are used for facilities, programs, and services that will not run as the superuser. In general, these accounts do not require interactive access, and thus do not have a valid login shell.
3. Answer: b) System accounts. System accounts typically do not have a valid login shell for security purposes.
4. Where is a user's home directory usually located on Linux systems?
a) /usr/home
b) /var/home
c) /home
d) /users
--------------------------
4 Answer Below:
--------------------------
/* --------------------- */
Explanation: On Linux systems, a user's home directory is usually located under the /home directory. This is the only location where that user account has guaranteed write access, with some exceptions.
4. Answer: c) /home. A user's home directory is usually located under the /home directory on Linux systems.
5. What is the purpose of setting up user accounts to not have any write access to their own home directory?
a) To prevent the user from accidentally deleting files
b) To limit the user's access to the system
c) To protect sensitive data from unauthorized access
d) To reduce the storage requirements for the home directory
--------------------------
5 Answer Below:
--------------------------
/* --------------------- */
Some user accounts are purposely setup to not have any write access to even their own home directory for security purposes.
Explanation: Setting up user accounts to not have any write access to their own home directory can help protect sensitive data from unauthorized access. This is especially important for user accounts that are used for sensitive purposes, such as those used by system administrators or security personnel.
5. Answer: c) To protect sensitive data from unauthorized access. Some user accounts are purposely setup to not have any write access to even their own home directory for security purposes.
6. What command can be used to list a user's UID, GID, and additional group memberships?
A) pwd
B) id
C) who
D) w
--------------------------
6 Answer Below:
--------------------------
/* --------------------- */
Explanation: The id command can be used to list a user's UID, GID, and additional group memberships, as well as other context information. The pwd command prints the current working directory, while the who and w commands list active logins and session information.
6. Answer: B) id
7. Which command can be used to list all of the last bad login attempts?
A) last
B) lastb
C) who
D) w
--------------------------
7 Answer Below:
--------------------------
/* --------------------- */
Explanation: The lastb command lists all of the last bad login attempts, while the last command lists all successful logins. The who and w commands list active logins and session information.
7. Answer: B) lastb
8. What information can be found in the output of the last command?
A) Current time and system uptime
B) CPU utilization times
C) UID and GID
D) Last successful logins
--------------------------
8 Answer Below:
--------------------------
/* --------------------- */
Explanation: The last command lists information about the last successful logins on the system, including the username, terminal or network device used to login, IP address, and login time. The other options listed are not included in the last command output.
8. Answer: D) Last successful logins
9. Which command lists information about currently active logins on the system?
A) last
B) lastb
C) who
D) w
--------------------------
9 Answer Below:
--------------------------
/* --------------------- */
Explanation: The who command lists information about currently active logins on the system, including the username, terminal or network device used to login, and login time. The last command lists information about past logins, while the lastb command lists information about failed login attempts. The w command lists more detailed information about active sessions.
9. Answer: C) who
10. What is the difference between the w and who commands?
A) The w command lists active sessions and CPU utilization times, while who only lists active logins.
B) The who command lists active sessions and CPU utilization times, while w only lists active logins.
C) The w command lists active sessions and the system uptime, while who only lists active logins.
D) The who command lists active sessions and the system uptime, while w only lists active logins.
--------------------------
10 Answer Below:
--------------------------
/* --------------------- */
Explanation: The w command lists more detailed information about active sessions, including the username, terminal or network device used to login, login time, and CPU utilization times. The who command only lists basic information about active logins. Neither command lists system uptime.
10. Answer: A) The w command lists active sessions and CPU utilization times, while who only lists active logins.
BONUS QUESTIONS:
11. You are the system administrator of a Linux server that handles sensitive data. You have recently discovered that some users have been accessing files and directories that they are not authorized to access. Which of the following commands would you use to change the ownership of a file and set permissions so that only the owner can read and write to it?
A. chown user:group file.txt; chmod 700 file.txt
B. chgrp group file.txt; chmod 640 file.txt
C. chmod 777 file.txt
D. chown user:group file.txt; chmod 777 file.txt
--------------------------
11 Answer Below:
--------------------------
/* --------------------- */
Explanation:
Option B is incorrect because it changes only the group ownership of the file and sets the permissions to allow the owner and group to read and write to it, but not other users. Option C is incorrect because it sets the permissions to allow all users to read, write, and execute the file. Option D is incorrect because it changes the ownership of the file and sets the permissions to allow all users to read, write, and execute the file.
11. Answer:
A. The command "chown user:group file.txt" changes the ownership of the
file to the specified user and group. The command "chmod 700 file.txt"
sets the file permissions so that only the owner can read and write to
it.
12. You are the system administrator of a Linux server that has been experiencing a series of security breaches. After analyzing the server logs, you have determined that the breaches are due to weak passwords and that some users are using their login credentials for multiple accounts. Which of the following actions would you take to improve the security of the system?
A. Force all users to change their passwords every week.
B. Implement a password policy that requires users to use complex passwords and change them every 90 days.
C. Limit the number of failed login attempts and lock user accounts after a certain number of failed attempts.
D. Require users to use multi-factor authentication to access the system.
--------------------------
12 Answer Below:
--------------------------
/* --------------------- */
Explanation:
Option A is not a good solution because it is not feasible to require users to change their passwords every week, and it can also cause user frustration and reduce productivity. Option C is a good solution, but it only addresses the issue of brute-force attacks and does not prevent weak passwords or password reuse. Option D is also a good solution, but it may not be practical for all users and may require additional hardware or software. Option B is the best solution because it addresses the issue of weak passwords and password reuse, and also provides a reasonable frequency for password changes.
12. Answer: B. Implement a password policy that requires users to use complex passwords and change them every 90 days.
13. You are the system administrator of a Linux server that hosts a website. The website has been experiencing a large amount of traffic lately, and you suspect that it may be due to a distributed denial of service (DDoS) attack. Which of the following actions would you take to mitigate the attack?
A. Increase the bandwidth of the server to handle the traffic.
B. Block traffic from specific IP addresses that are sending too many requests.
C. Install a firewall to block all incoming traffic except for HTTP and HTTPS.
D. Configure the server to use a content delivery network (CDN) to distribute the traffic.
--------------------------
13 Answer Below:
--------------------------
/* --------------------- */
Explanation: Option A is not a good solution because it does not address the issue of the attack itself and can be expensive. Option C is not a good solution because it may block legitimate traffic and can be difficult to configure correctly. Option D is a good solution, but it may require additional setup and configuration. Option B is the best solution because it targets the specific IP addresses that are sending
13 Answer: B. Block traffic from specific IP addresses that are sending too many requests.