MODULE 15 - System and User security Flashcards
Which command allows you to run a shell as a different user in Linux?
The su command allows you to switch users and run commands under another user’s privileges, often used to switch to the root user.
Which 3 options fully configure the new shell with the settings of the new user, ensuring that all commands are executed correctly?
The login shell option (su -, su -l, su –login) fully configures the new shell with the settings of the new user, ensuring that all commands are executed correctly.
What is the default behavior when no username is provided with the su command?
By default, the su command opens a new shell as the root user.
How can you specify the login shell option when using the su command?
You can specify the login shell option with one of these commands:
su -
su -l
su –login
Which command allows a user to execute a single command as another user, typically the root user, without switching shells?
The sudo command lets users execute commands with elevated privileges, assuming root permissions by default.
What command is equivalent to su - root when switching to the root user?
The command su - is equivalent to su - root when switching to the root user.
What should you use to return to your original user account after performing administrative tasks with the root user?
To return to your original shell, use the exit command.
How can you confirm successfully switching to the root user using the su command?
The id command is used to confirm successfully switching to the root user using the su command.
Which password is required when using the sudo command to execute a privileged command?
The user must enter their own password, not the root user’s password, when prompted by sudo.
What is the default timeout period during which the password prompt does not reappear for sudo after a successful entry?
Five minutes is the default timeout window during which a user can run additional sudo commands without being prompted again.
Which logging advantage does sudo offer that su does not?
Each command run with sudo is logged individually, showing the user, time, and specific command, ensuring better accountability.
Which file in the /etc directory contains basic user account information for all users on the system?
/etc/passwd file in the /etc directory contains basic user account information for all users on the system.
What does an x in the second field of a line in /etc/passwd indicate?
The actual password is stored in /etc/shadow, not in /etc/passwd.
Which command is used to check if a specific user (e.g., sysadmin) exists in the /etc/passwd file?
grep sysadmin /etc/passwd command is used to check if a specific user exists in the /etc/passwd file.
What is the purpose of the third field (e.g., 1001) in a line from /etc/passwd?
It represents the User ID (UID) used by the system internally to identify the user.
What does the fourth field in /etc/passwd specify?
The Primary Group ID (GID) the user belongs to.
What is typically stored in the fifth field (the comment field) of the /etc/passwd file?
User information such as the real name or other identifiers (e.g., “System Administrator”).
Where is the default home directory for a regular user like bob located?
/home/bob
What is the default home directory for the root user?
/root
Which field in the /etc/passwd file defines the user’s default shell at login?
The seventh field, typically something like /bin/bash
Which shell is most commonly assigned as the login shell for Linux users?
/bin/bash
What does the $6$ prefix in the password field indicate in the following /etc/shadow line?
sysadmin:$6$c75ekQWF$…:16874:5:30:7:60:15050:
It indicates that the password is encrypted.
Which field in the following /etc/shadow line shows the exact number of days since the password was last changed: sysadmin:$6$c75ekQWF$…:16874:5:30:7:60:15050: ?
The third field (16874) shows the last change date, representing the number of days since the Unix Epoch (Jan 1, 1970).
In this /etc/shadow line, what does the 5 represent?
sysadmin:$6$c75ekQWF$…:16874:5:30:7:60:15050:
It represents the minimum number of days required between password changes—meaning the user must wait 5 days before changing the password again.