Users and Groups Flashcards

Objective 2.2: Given a scenario, implement identity management (47 cards)

1
Q

Which of the following best describes the root account in Linux?

πŸ”˜ Options
A. A non-human background account used for services
B. A regular user account with limited access
C. The most powerful account with full system access
D. An account used only for SSH login

A

βœ… Correct Answer
C. The most powerful account with full system access

πŸ’‘ Explanation
A. ❌ This is a service account, not the root account.

B. ❌ A standard user, not root.

C. βœ… Correct β€” root can read, write, delete any file, and change system-wide settings.

D. ❌ Any user may be used for SSH β€” this isn’t exclusive to root.

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

What is the purpose of the β€˜sudoers’ file?

πŸ”˜ Options
A. To store service logs for user accounts
B. To define which users have administrative privileges
C. To manage login attempts and failures
D. To monitor background services

A

βœ… Correct Answer
B. To define which users have administrative privileges

πŸ’‘ Explanation
A. ❌ Service logs are handled by syslog, journald, etc.

B. βœ… Correct β€” the /etc/sudoers file controls sudo access.

C. ❌ That’s handled by log tools like faillog, not sudoers.

D. ❌ Background services are monitored by systemd or service tools.

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

What makes visudo safer than editing /etc/sudoers directly?

πŸ”˜ Options
A. It opens in a hidden mode that can’t be seen by others
B. It encrypts the sudoers file
C. It checks for syntax errors and prevents lockout
D. It runs the file in a container

A

βœ… Correct Answer
C. It checks for syntax errors and prevents lockout

πŸ’‘ Explanation
A. ❌ Visudo isn’t hidden β€” it’s about safe editing.

B. ❌ No encryption is involved.

C. βœ… Correct β€” it checks syntax before saving to avoid locking you out of sudo.

D. ❌ There’s no container use β€” it’s just a safer editor wrapper.

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

Which statement about sudoedit is true?

πŸ”˜ Options
A. It runs your editor as root, just like sudo nano
B. It lets you edit files with elevated privileges safely
C. It only works on .conf files
D. It replaces the sudoers file entirely

A

βœ… Correct Answer
B. It lets you edit files with elevated privileges safely

πŸ’‘ Explanation
A. ❌ sudoedit runs the editor as your user, not root.

B. βœ… Correct β€” it safely lets you edit, and uses sudo only to save changes.

C. ❌ It can edit any file, not just .conf.

D. ❌ It does not replace files, just edits them.

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

What is the β€˜wheel’ group used for in Linux?

πŸ”˜ Options
A. To restrict access to graphical applications
B. To limit SSH login attempts
C. To allow group members to use sudo
D. To monitor user activities

A

βœ… Correct Answer
C. To allow group members to use sudo

πŸ’‘ Explanation
A. ❌ Not related to GUI access.

B. ❌ SSH login policies are managed elsewhere.

C. βœ… Correct β€” members of the wheel group can use sudo when allowed in /etc/sudoers.

D. ❌ Activity monitoring is done by audit or logging tools.

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

How does polkit differ from sudo?

πŸ”˜ Options
A. polkit is used for command-line actions only
B. sudo is used for background processes
C. polkit checks GUI-based policy rules instead of sudoers
D. sudo requires no password while polkit does

A

βœ… Correct Answer
C. polkit checks GUI-based policy rules instead of sudoers

πŸ’‘ Explanation
A. ❌ polkit is mostly for GUI/background actions.

B. ❌ sudo is used by the user on CLI, not by background processes.

C. βœ… Correct β€” polkit uses its own rules separate from /etc/sudoers.

D. ❌ Both may require passwords depending on system config.

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

What is the purpose of the pkexec command?

πŸ”˜ Options
A. To check file permissions
B. To reboot the system
C. To run commands as another user using Polkit
D. To open a shell as root using sudo

A

βœ… Correct Answer
C. To run commands as another user using Polkit

πŸ’‘ Explanation
A. ❌ Use ls -l or stat to check file permissions.

B. ❌ Use reboot or shutdown, not pkexec.

C. βœ… Correct β€” pkexec uses Polkit to elevate permissions like sudo.

D. ❌ sudo -i opens a root shell β€” not pkexec.

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

What does the command /sbin/shutdown -h now do in Linux?

πŸ”˜ Options
A. It creates a new shutdown configuration file
B. It halts (shuts down) the system immediately
C. It displays system uptime
D. It restarts the system

A

βœ… Correct Answer
B. It halts (shuts down) the system immediately

πŸ’‘ Explanation
A. ❌ No configuration file is created.

B. βœ… Correct β€” -h means halt, and now means immediately.

C. ❌ Use uptime or w for that.

D. ❌ To restart, you’d use reboot, not shutdown -h.

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

Why do most commands in /sbin/ require sudo or root privileges?

πŸ”˜ Options
A. They are not executable by any user
B. They handle non-critical background tasks
C. They can affect system-wide settings or stability
D. They only work inside user home directories

A

βœ… Correct Answer
C. They can affect system-wide settings or stability

πŸ’‘ Explanation
A. ❌ They are executable but restricted to privileged users.

B. ❌ They handle critical tasks, not background ones.

C. βœ… Correct β€” commands like shutdown, fsck, and iptables need elevated privileges.

D. ❌ These commands are system-wide, not limited to home directories.

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

Which of the following commands typically resides in /sbin/ and requires sudo?

πŸ”˜ Options
A. ls
B. reboot
C. nano
D. cat

A

βœ… Correct Answer
B. reboot

πŸ’‘ Explanation
A. ❌ ls is in /bin or /usr/bin, used by regular users.

B. βœ… Correct β€” reboot is a system-level command and requires sudo.

C. ❌ nano is a text editor, generally doesn’t need sudo.

D. ❌ cat is used to read file contents and is user-level.

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

What does which shutdown return on most Linux systems?

πŸ”˜ Options
A. The shutdown history of the system
B. A man page with shutdown instructions
C. The full path to the shutdown binary
D. A configuration script for shutdown

A

βœ… Correct Answer
C. The full path to the shutdown binary

πŸ’‘ Explanation
A. ❌ last or journalctl would show shutdown history.

B. ❌ man shutdown would show documentation.

C. βœ… Correct β€” which shows where the command is stored (usually /sbin/shutdown).

D. ❌ There’s no script output; it’s a binary location.

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

Which command is used to check and repair file systems in Linux and typically lives in /sbin/?

πŸ”˜ Options
A. mount
B. fsck
C. lsblk
D. findmnt

A

βœ… Correct Answer
B. fsck

πŸ’‘ Explanation
A. ❌ mount mounts file systems, not repairs them.

B. βœ… Correct β€” fsck (file system check) is a repair tool and requires sudo.

C. ❌ lsblk lists block devices, not for repair.

D. ❌ findmnt shows mounted filesystems but doesn’t repair.

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

Where are most user-level commands like ls, cp, mv, and curl stored?

πŸ”˜ Options
A. /sbin
B. /etc
C. /usr/bin
D. /boot

A

βœ… Correct Answer
C. /usr/bin

πŸ’‘ Explanation
A. ❌ /sbin is for administrative tools.

B. ❌ /etc stores config files, not binaries.

C. βœ… Correct β€” /usr/bin holds standard user-level commands.

D. ❌ /boot contains bootloader files and kernels.

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

Which /usr/bin command requires sudo only when modifying files owned by another user?

πŸ”˜ Options
A. mv
B. chown
C. cat
D. echo

A

βœ… Correct Answer
B. chown

πŸ’‘ Explanation
A. ❌ mv usually doesn’t require sudo unless you’re writing to protected areas.

B. βœ… Correct β€” chown (change ownership) requires elevated permissions for files you don’t own.

C. ❌ cat is a read-only command.

D. ❌ echo prints to screen or files you have write access to.

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

Which /usr/bin command may require sudo if stopping a process you don’t own?

πŸ”˜ Options
A. top
B. kill
C. ps
D. uptime

A

βœ… Correct Answer
B. kill

πŸ’‘ Explanation
A. ❌ top is just for viewing.

B. βœ… Correct β€” kill can only stop your own processes unless you use sudo.

C. ❌ ps is for viewing processes.

D. ❌ uptime shows how long the system has been running.

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

What does the useradd -D command do in Linux?

πŸ”˜ Options
A. Deletes a default user account
B. Displays or sets default user creation values
C. Deletes all user passwords
D. Displays disk usage for each user

A

βœ… Correct Answer
B. Displays or sets default user creation values

πŸ’‘ Explanation
A. ❌ The -D flag doesn’t delete users.

B. βœ… Correct β€” useradd -D shows or modifies the system-wide defaults for new users (e.g., shell, home path).

C. ❌ Passwords are managed with passwd or chage.

D. ❌ Use du or quota for disk usage info.

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

What is the purpose of the SKEL field in useradd -D defaults?

πŸ”˜ Options
A. Stores user email settings
B. Specifies shell encryption method
C. Defines which default files are copied into new user home directories
D. Controls the shell version used by users

A

βœ… Correct Answer
C. Defines which default files are copied into new user home directories

πŸ’‘ Explanation
A. ❌ Not related to email.

B. ❌ Encryption methods are defined elsewhere, like in /etc/login.defs.

C. βœ… Correct β€” /etc/skel contains default config files (e.g., .bashrc) that are copied to new users’ home folders.

D. ❌ The shell is defined with the SHELL field.

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

If the default shell is set using sudo useradd -D -s /bin/zsh, what will happen?

πŸ”˜ Options
A. All existing users will be switched to Zsh
B. All future users will have /bin/zsh as their login shell
C. The Zsh package will be installed automatically
D. No changes will occur until /etc/shadow is edited

A

βœ… Correct Answer
B. All future users will have /bin/zsh as their login shell

πŸ’‘ Explanation
A. ❌ Only new users are affected, not existing ones.

B. βœ… Correct β€” this sets Zsh as the default shell for users created after this change.

C. ❌ Shell packages must be installed manually.

D. ❌ /etc/shadow controls password settings, not shell.

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

Why is it unsafe to manually edit /etc/passwd?

πŸ”˜ Options
A. It causes file permissions to change
B. It may corrupt system logs
C. It can break user records and affect login ability
D. It deletes the user if you make a typo

A

βœ… Correct Answer
C. It can break user records and affect login ability

πŸ’‘ Explanation
A. ❌ Permissions are not auto-altered by editing.

B. ❌ Not directly related to logs.

C. βœ… Correct β€” manual edits can introduce syntax errors that prevent users from logging in.

D. ❌ Typos may break things but won’t auto-delete accounts.

20
Q

Why were password hashes moved from /etc/passwd to /etc/shadow?

πŸ”˜ Options
A. To reduce disk usage
B. To allow users to see their own passwords
C. Because /etc/passwd is world-readable
D. To speed up the boot process

A

βœ… Correct Answer
C. Because /etc/passwd is world-readable

πŸ’‘ Explanation
A. ❌ File size wasn’t the issue.

B. ❌ Showing passwords is a security flaw.

C. βœ… Correct β€” since any user can read /etc/passwd, password hashes were moved to /etc/shadow, which is restricted.

D. ❌ This change wasn’t about boot speed.

21
Q

Which file stores hashed user passwords and password expiration info in modern Linux systems?

πŸ”˜ Options
A. /etc/group
B. /etc/passwd
C. /etc/skel
D. /etc/shadow

A

βœ… Correct Answer
D. /etc/shadow

πŸ’‘ Explanation
A. ❌ /etc/group stores group memberships.

B. ❌ No longer stores hashed passwords.

C. ❌ /etc/skel contains default files for new user home directories.

D. βœ… Correct β€” /etc/shadow securely stores password hashes and expiration info.

22
Q

What does the -D option do in the useradd command?

πŸ”˜ Options
A. Deletes a user account
B. Disables password login
C. Views or sets default user creation settings
D. Displays disk usage

A

βœ… Correct Answer
C. Views or sets default user creation settings

πŸ’‘ Explanation
A. ❌ Use userdel to delete users.

B. ❌ passwd -l locks login, not useradd -D.

C. βœ… Correct β€” useradd -D controls system-wide defaults like shell and home base.

D. ❌ Use du for disk usage.

23
Q

What happens if INACTIVE=-1 is set in useradd -D?

πŸ”˜ Options
A. Password never expires
B. Account is disabled immediately after password expiration
C. Account is never disabled, even after password expires
D. Account is locked after 1 day

A

βœ… Correct Answer
C. Account is never disabled, even after password expires

πŸ’‘ Explanation
A. ❌ Expiry and inactivity are different.

B. ❌ That would be a 0, not -1.

C. βœ… Correct β€” -1 means no auto-disable after password expiry.

D. ❌ Not a valid setting here.

24
Q

What does the -m flag in useradd -m username do?

πŸ”˜ Options
A. Changes the user’s password
B. Creates a mail account
C. Creates a home directory and copies default files
D. Makes the user a system admin

A

βœ… Correct Answer
C. Creates a home directory and copies default files

πŸ’‘ Explanation
A. ❌ Passwords are set using passwd.

B. ❌ Mail creation is separate.

C. βœ… Correct β€” -m sets up /home/username with contents from /etc/skel.

D. ❌ Admin privileges require group/sudoer configuration.

25
What is the function of the SKEL=/etc/skel directory? πŸ”˜ Options A. Stores system logs B. Contains default config files copied to new home directories C. Stores user passwords D. Sets user permissions
βœ… Correct Answer B. Contains default config files copied to new home directories πŸ’‘ Explanation A. ❌ Logs are in /var/log. B. βœ… Correct β€” /etc/skel is a template for new users. C. ❌ Passwords are in /etc/shadow. D. ❌ Permissions are set using chmod or chown.
26
Where are secure hashed passwords stored in modern Linux systems? πŸ”˜ Options A. /etc/passwd B. /etc/login.defs C. /etc/shadow D. /etc/skel
βœ… Correct Answer C. /etc/shadow πŸ’‘ Explanation A. ❌ Used to store hashes but is now public/readable. B. ❌ Sets password policy, not passwords themselves. C. βœ… Correct β€” /etc/shadow is secure and root-only. D. ❌ For copying default user files.
27
What does sudo !! do? πŸ”˜ Options A. Repeats the last command with elevated privileges B. Shows previous users C. Reloads system daemons D. Logs out the user
βœ… Correct Answer A. Repeats the last command with elevated privileges πŸ’‘ Explanation A. βœ… Correct β€” helpful when you forgot to prefix a command with sudo. B. ❌ Use last for that. C. ❌ Use systemctl daemon-reexec for that. D. ❌ Use logout or exit.
28
What does the chage command manage? πŸ”˜ Options A. File permissions B. User login shell C. Password aging policies D. Group ownership
βœ… Correct Answer C. Password aging policies πŸ’‘ Explanation A. ❌ That’s chmod. B. ❌ That’s usermod. C. βœ… Correct β€” chage adjusts max days, warnings, etc. D. ❌ Use chgrp or chown.
29
What does passwd -l username do? πŸ”˜ Options A. Locks the user's files B. Logs the user out immediately C. Locks the account by disabling password login D. Deletes the user
βœ… Correct Answer C. Locks the account by disabling password login πŸ’‘ Explanation A. ❌ Doesn’t affect files. B. ❌ Doesn’t log out sessions. C. βœ… Correct β€” adds a ! in /etc/shadow. D. ❌ Use userdel to remove users.
30
Question: What is the purpose of the -g flag when using the groupadd command? Options: A) Automatically assigns a name to the group B) Assigns a custom Group ID (GID) C) Grants admin rights to the group D) Adds the group to /etc/passwd
Answer: B) Assigns a custom Group ID (GID) Explanation: A) Incorrect β€” group names must be set manually. B) βœ… Correct β€” -g is used to set a specific GID, helpful for consistent user permissions across systems. C) Incorrect β€” admin rights aren't managed through groupadd. D) Incorrect β€” /etc/group is where group info is stored, not /etc/passwd.
31
Question: How does the -f option affect the groupadd command? Options: A) Forces the group to be deleted B) Ignores errors if the group already exists C) Fixes permissions for the group D) Finds and displays existing group members
Answer: B) Ignores errors if the group already exists Explanation: A) Incorrect β€” that would relate to groupdel, not groupadd. B) βœ… Correct β€” -f tells groupadd not to throw an error if the group already exists. C) Incorrect β€” permissions are managed separately with chmod or chown. D) Incorrect β€” this is unrelated to group creation.
32
Question: Which option must be used with -o to allow duplicate GIDs? Options: A) -n B) -f C) -g D) -r
Answer: C) -g Explanation: A) Incorrect β€” -n isn’t a valid option in groupadd. B) Incorrect β€” -f is for ignoring errors, not related to duplicate GIDs. C) βœ… Correct β€” -o only works if you're specifying a GID using -g. D) Incorrect β€” -r is used to create system groups, not related to duplication.
33
Question: What is the correct and safe way to add a user to a new group without removing them from existing group memberships? Options: A) usermod -G groupname username B) usermod -aG groupname username C) adduser username groupname D) groupmod -a username groupname
Answer: B) usermod -aG groupname username Explanation: A) ❌ This replaces the user’s current groups. B) βœ… Correct β€” -a (append) and -G (group) ensures the user is added safely. C) ❌ Not the proper syntax in all distros. D) ❌ Invalid command; groupmod is for modifying group properties, not users.
34
Question: What does the -a option do when used with the usermod command? Options: A) Automatically assign a primary group B) Append the user to additional groups without removing current ones C) Assign the user admin privileges D) Set account expiration time
Answer: B) Append the user to additional groups without removing current ones Explanation: A) ❌ Primary group is handled with -g. B) βœ… Correct β€” -a ensures no existing group memberships are lost. C) ❌ Admin rights come from group membership like sudo. D) ❌ That would be managed by chage.
35
Question: What happens if you run sudo usermod -G devteam mousa without the -a flag? Options: A) The user is safely added to the devteam group B) Nothing happens unless the user exists C) The user is removed from all groups except devteam D) The user's shell is changed
Answer: C) The user is removed from all groups except devteam Explanation: A) ❌ Not safely β€” this removes all previous groups. B) ❌ The user must exist, but that’s not the issue here. C) βœ… Correct β€” without -a, -G replaces group memberships. D) ❌ Shell changes use -s.
36
Question: What is the primary purpose of the last command in Linux? Options: A) To display active processes B) To list the most recent login and reboot events C) To terminate user sessions D) To switch users
Answer: B) To list the most recent login and reboot events Explanation: A) ❌ That’s what top or ps is for B) βœ… Correct β€” last reads from /var/log/wtmp to show login/logout/reboot history C) ❌ kill or pkill is used to terminate sessions D) ❌ su or sudo switches users
37
Question: From which file does the last command retrieve its information? Options: A) /etc/passwd B) /var/log/auth.log C) /var/log/wtmp D) /etc/login.defs
Answer: C) /var/log/wtmp Explanation: A) ❌ /etc/passwd stores user account info B) ❌ Authentication logs, not session history C) βœ… Correct β€” this binary file logs login/logout events D) ❌ That file stores password and user account policy
38
Question: What does the terminal label pts/0 represent in the output of the last command? Options: A) A local keyboard login B) A graphical login session C) A remote login terminal (like SSH) D) A reboot message
Answer: C) A remote login terminal (like SSH) Explanation: A) ❌ Local login would be shown as tty1 B) ❌ Graphical sessions aren’t labeled like this C) βœ… Correct β€” pts/0 is a pseudo-terminal often associated with remote access like SSH D) ❌ Reboots appear as "reboot" in the user column
39
Question: In the last command output, what does the entry reboot system boot indicate? Options: A) A user manually restarted their session B) A failed login attempt C) The system was restarted D) A new user account was added
Answer: C) The system was restarted Explanation: A) ❌ This isn’t about a user session B) ❌ That would show in authentication logs C) βœ… Correct β€” reboot logs system restarts D) ❌ Not related to user account management
40
Q: What is the purpose of the .bashrc file in a Linux system, and when does it get executed? Options: A. It configures the user's environment at every system boot. B. It’s a hidden file that runs when a user logs in via SSH. C. It’s a hidden file that runs every time a new interactive terminal session is opened. D. It stores system-wide PATH variables and executes only during system updates.
Explanation: A is incorrect – system boot processes are handled by systemd, not .bashrc. B is incorrect – SSH login triggers .bash_profile, not .bashrc. βœ… C is correct – .bashrc is executed every time an interactive shell is opened, such as a terminal window or tab. D is incorrect – PATH variables can be set in .bashrc, but it’s not exclusive to system updates or system-wide usage.
41
Q: What types of customizations are commonly added to a user's .bashrc file? Options: A. Kernel module settings and device driver configurations B. Aliases, environment variables, prompt appearance, and custom PATHs C. Service startup commands like Apache or MySQL D. Disk partitioning schemes and bootloader configs
Explanation: A is incorrect – kernel modules are managed with tools like modprobe, not .bashrc. βœ… B is correct – .bashrc is used for defining command aliases, setting environment variables, customizing the prompt (PS1), and appending directories to PATH. C is incorrect – service management is done through systemctl or init scripts, not .bashrc. D is incorrect – bootloader configs are part of /boot or /etc/default/grub, unrelated to .bashrc.
42
Q: How can a user apply changes made in their .bashrc file without restarting the terminal? Options: A. Restart the shell using reboot-shell B. Execute the command source ~/.bashrc or . ~/.bashrc C. Open a new browser window D. Kill the terminal process and reopen it
Explanation: A is incorrect – reboot-shell is not a valid command. βœ… B is correct – source ~/.bashrc (or . ~/.bashrc) reloads the file in the current session, applying any changes immediately. C is incorrect – opening a browser has nothing to do with shell configuration. D is partially effective – closing and reopening a terminal will apply .bashrc, but it’s less efficient than sourcing it.
43
Q: When is the .bash_profile file executed in a Linux system? Options: A. Every time a new terminal tab is opened B. During login shell sessions, like SSH or TTY C. When the system is shutting down D. When .bashrc is missing or corrupted
Explanation: A is incorrect – terminal tabs launch interactive shells that use .bashrc. βœ… B is correct – .bash_profile is used for login shells such as SSH or virtual consoles (TTY). C is incorrect – shutdown processes are unrelated to .bash_profile. D is incorrect – .bash_profile doesn’t serve as a fallback for .bashrc; in fact, it often explicitly sources .bashrc.
44
What is the key difference between ~/.bashrc and /root/.bashrc in a Linux system? (Choose the best answer) A. They are identical and used by all users B. ~/.bashrc is for the current user, /root/.bashrc is for the root user C. They both serve only to change graphical login settings D. /root/.bashrc is copied automatically from ~/.bashrc at login
βœ… Correct Answer: B πŸ“˜ Explanation: B is correct: ~/.bashrc belongs to regular users, while /root/.bashrc is the root user's shell configuration file. Each file controls the shell behavior for its respective user. A is incorrect: They are not shared; each user has their own .bashrc. C is incorrect: These files are for terminal shell configuration, not graphical login. D is incorrect: The system does not auto-copy .bashrc from one user to another.
45
Why might an alias defined in ~/.bashrc not work when switching to root with sudo -i? A. Because the shell ignores aliases B. Because root's environment does not use .bashrc C. Because aliases must be defined in /root/.bashrc to apply when logged in as root D. Because sudo blocks all user-level configuration
βœ… Correct Answer: C πŸ“˜ Explanation: C is correct: When using sudo -i, you start a login shell as root, which uses /root/.bashrc. If the alias isn’t defined there, it won’t exist for the root user. A is incorrect: Shells do use aliases when properly defined. B is incorrect: Root does use .bashrc, but its own (/root/.bashrc). D is incorrect: sudo does not block aliases; it simply doesn’t load .bashrc unless invoked with -i.
46
Which command ensures that root's .bashrc is loaded when switching to the root environment? A. sudo su B. sudo -i C. sudo bash D. su -c
βœ… Correct Answer: B πŸ“˜ Explanation: B is correct: sudo -i starts a login shell, loading /root/.bashrc if it exists. A is incorrect: sudo su doesn’t guarantee loading a login shell unless used with -l. C is incorrect: Starts a non-login shell. D is incorrect: Runs a single command as another user, not a full login shell.
47
What is the function of the $PATH variable set in .bash_profile or .profile? A. Defines user interface themes B. Stores backup scripts C. Tells Linux where to find executable commands D. Enables root permissions automatically
βœ… Correct Answer: C πŸ“˜ Explanation: C is correct: $PATH defines which directories Linux searches when you type a command like ls. A is incorrect: Themes are unrelated to $PATH. B is incorrect: It’s not for storing files. D is incorrect: It has nothing to do with privileges.