LPI 101-500 LPIC-1 Exam 101 Exam Dumps and Practice Test Questions Set6 Q101-120

Visit here for our full LPI 101-500 exam dumps and practice test questions.

Question 101:

Which command changes the ownership of a file to a specific user and group?

A) chmod user: group file
B) chown user: group file
C) chgrp user: group file
D) usermod file

Answer: B) chown user: group file

Explanation:

Chown modifies the file owner and optionally the group. chgrp changes only the group, chmod changes permissions, and usermod modifies user accounts.

In Linux, managing file ownership and permissions is a fundamental aspect of system administration and security. Several commands exist to modify ownership, group membership, and file access rights, including chown, chgrp, chmod, and usermod. Each serves a distinct purpose, and understanding their functionality is critical for proper Linux administration and for the LPIC-1 101 exam.

The chown command is used to change the ownership of a file or directory. It allows administrators to assign a new user as the owner of a file and, optionally, change the group simultaneously. The syntax is typically:

chown [owner][:[group]] file

 

For example, chown john: developers file.txt sets john as the owner and developers as the group of file.txt. The -R option can be added to apply ownership changes recursively to all files and directories within a folder, which is particularly useful for directories shared by multiple users.

The chgrp command is closely related but modifies only the group ownership of a file or directory, without affecting the file’s user owner. For example, chgrp developers file.txt changes the group to developers but leaves the user owner unchanged. This is useful in collaborative environments where multiple users share access to the same files through group permissions.

The chmod command changes file permissions, not ownership. It defines which users can read, write, or execute a file, using either symbolic notation (e.g., chmod u+r file.txt) or numeric modes (e.g., chmod 755 file.txt). While chown and chgrp control who owns the file, chmod controls what each user or group can do with it. Permissions are divided into three categories: owner, group, and others.

The usermod command is completely different—it modifies user account attributes, not individual files. It can change a user’s login shell, home directory, primary group, or add the user to supplementary groups. For example, usermod –aG developers john adds john to the developers group without affecting existing groups. usermod does not alter file ownership directly, but changes it indirectly when a user’s primary group is modified, as new files created by that user inherit the new primary group.

Question 102:

What does the -R option in chown do?

A) Changes permissions
B) Recursively changes ownership for all files and subdirectories
C) Changes only the specified file
D) Reverses ownership

Answer: B) Recursively changes ownership for all files and subdirectories

Explanation: 

R applies chown to the directory and all its contents, ensuring consistent ownership.

In Linux, managing file and directory ownership is crucial for maintaining proper access control and security. The chown command allows administrators to change the owner and group of a file or directory. However, in real-world scenarios, directories often contain many nested files and subdirectories. Changing ownership individually for each item can be time-consuming and error-prone. This is where the -R (recursive) option of chown becomes essential.

The -R option enables chown to apply ownership changes recursively, meaning it updates the specified directory as well as all its contents, including subdirectories and files. Without -R, chown only affects the single directory or file explicitly mentioned. Recursive ownership modification ensures that all files within a directory hierarchy inherit the specified owner and group, providing consistency and avoiding permission-related issues that can arise if some files remain under the previous owner or group.

For example, consider a web server directory /var/www/html with multiple subdirectories and files. To assign all files to user www-data and group www-data, the administrator can run:

sudo chown -R www-data:www-data /var/www/html

 

This command changes the owner and group of /var/www/html and every nested file and folder, ensuring that the web server can access all files properly. Without the -R option, only the /var/www/html directory itself would be updated, leaving the contained files inaccessible to the intended user or group.

The recursive change is particularly important in collaborative environments or when migrating ownership of entire project directories. It ensures uniform ownership, prevents permission conflicts, and supports the smooth operation of services that rely on consistent access rights.

While R is powerful, it must be used carefully. Incorrect recursive changes can unintentionally modify ownership of system-critical directories or files, potentially breaking services or compromising security. Therefore, administrators should double-check the target path and, if necessary, test on a small subset before applying changes recursively on large directories.

Additionally, combining -R with other options can enhance efficiency. For example, chown -R –verbose user: group directory not only applies ownership changes recursively but also provides a report of every file modified, which is useful for auditing and troubleshooting.

Question 103:

Which command shows a snapshot of all running processes?

A) top
B) ps aux
C) uptime
D) free -h

Answer: B) ps aux

Explanation:

Ps aux provides a static snapshot of all processes with details like CPU and memory usage. Topp is interactive and real-time.

In Linux, monitoring processes is a core task for system administrators to maintain performance, troubleshoot issues, and ensure system stability. Two commonly used commands for this purpose are ps aux and top, each providing different perspectives on process activity. Understanding their differences and proper usage is essential for effective system management and for the LPIC-1 101 exam.

The ps command, short for “process status,” is used to display information about running processes. When combined with the options aux, it provides a comprehensive snapshot of all processes on the system. The meaning of aux is as follows:

A shows processes for all users, not just the current user.

u display detailed information, including the user/owner, CPU usage, memory usage, and start time.

x includes processes not attached to a terminal, such as background daemons.

An example output of ps aux includes columns such as USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, and COMMAND. This information allows administrators to identify resource-hungry processes, analyze memory and CPU consumption, and troubleshoot performance issues. Importantly, ps aux provides a static snapshot, reflecting the state of processes at the exact moment the command is executed. This is useful for scripts, logging, or capturing a momentary view of system activity.

In contrast, the top command provides a dynamic, interactive view of system processes. Unlike ps aux, top continuously updates the display, showing real-time CPU, memory, and swap usage for all processes. The command also summarizes overall system resource usage at the top of the screen, including total tasks, CPU utilization, memory usage, and load averages over 1, 5, and 15 minutes.

One of the key benefits of the top is interactivity. Users can:

Sort processes by CPU or memory usage by pressing P or M.

Kill or renice processes directly from the interface.

Monitor the system continuously without running the command repeatedly.

While ps aux is better for scripted or one-time process inspection, top is ideal for real-time monitoring and dynamic troubleshooting. Together, these tools complement each other: ps aux provides precise snapshots for logging or analysis, while top offers continuous, interactive monitoring to detect spikes or abnormal behavior immediately.

Question 104:

Which command displays processes in real-time, sorted by CPU or memory usage?

A) ps aux
B) top
C) uptime
D) who

Answer: B) top

Explanation:

The top shows a dynamic view of processes and system resources. Users can interactively sort and kill processes.

In Linux, monitoring processes and system resources is critical for administrators to ensure optimal performance, prevent system overload, and troubleshoot issues. One of the most powerful tools for this purpose is the top command. Unlike static process commands such as ps aux, which provide a snapshot of processes at a single point in time, top provides a dynamic, real-time view of processes and system metrics, making it indispensable for interactive system monitoring and resource management.

When you run the top command, it displays a continuously updating list of running processes along with a summary of system resources, including CPU usage, memory consumption, swap utilization, and load averages. This real-time aspect allows administrators to detect spikes in CPU or memory usage immediately, which is crucial for performance tuning and early detection of resource bottlenecks.

The top section of the output shows overall system information, including:

System uptime – how long the system has been running.

Number of users logged in – current active sessions.

Load averages – system load over the past 1, 5, and 15 minutes.

CPU states – percentage of CPU time spent in user mode, system mode, idle, and waiting for I/O.

Memory usage – total, used, free, shared, buffer, and cache memory.

Swap usage – total swap, used swap, and free swap space.

Below this summary, the top lists individual processes with details such as PID (Process ID), user, priority (PR), nice value (NI), virtual memory (VIRT), resident memory (RES), shared memory (SHR), CPU usage (%CPU), memory usage (%MEM), and command name. This information allows administrators to identify resource-intensive processes and take corrective action quickly.

One of the main advantages of the top is its interactivity. Users can perform actions directly from the interface:

Pressing P sorts processes by CPU usage, while M sorts by memory usage, making it easier to identify the heaviest consumers of system resources.

Pressing K allows the administrator to kill a process by specifying its PID, which is useful for terminating runaway processes.

Pressing R can renice a process, adjusting its priority to give it more or less CPU time.

Pressing H toggles thread view, useful for multi-threaded applications.

Top also supports customization, including changing the refresh interval, filtering processes by user, and displaying specific columns. These options allow administrators to tailor the interface for monitoring specific applications or subsystems.

In addition to system administration, top is useful for performance tuning. By monitoring CPU and memory usage trends in real-time, administrators can identify which processes consume excessive resources, whether memory leaks are occurring, or if CPU-intensive tasks need rescheduling. It is also valuable for capacity planning, helping predict when additional resources may be required.

Question 105:

Which command shows all files, including hidden files, in a directory?

A) ls
B) ls -a
C) ls -l
D) ls -lh

Answer: B) ls -a

Explanation:

 displays all files, including those starting with a dot (hidden files).

In Linux, managing files and directories effectively requires a clear understanding of how the filesystem works, particularly with hidden files. By default, Linux hides files that begin with a dot (.), such as .bashrc, .profile, or .gitconfig. These hidden files are not displayed when executing the standard ls command. Hidden files typically contain configuration settings, system preferences, or user-specific application data. To view these files, the -a option of the ls command is used.

The -a option, short for “all,” tells ls to display all files in a directory, including hidden ones. When you run ls -a, the output will include both regular files and dot files, along with the special entries. And.., representing the current directory and the parent directory, respectively. This is important for system administrators and power users because hidden files often control environment settings, shell behavior, and application configurations. For example, .bashrc contains shell customizations for Bash, and .ssh stores SSH keys used for secure connections. If hidden files are not visible, crucial configurations might be overlooked during troubleshooting or system audits.

Using ls -a in combination with other options increases its utility. For instance, ls -la or ls -al combines the -l (long listing format) and -a options, showing all files with detailed information such as file permissions, owner, group, size, and modification time. This is particularly useful when administrators need to verify file permissions of hidden configuration files, ensuring correct ownership and access rights.

The ability to view hidden files also plays a critical role in security and system maintenance. Some malware or unauthorized scripts may hide themselves by prefixing their filenames with a dot. Using ls -a allows administrators to detect these hidden files and investigate suspicious activity. Furthermore, when migrating or backing up a user’s home directory, including hidden files ensures that all configuration files, environment variables, and application settings are preserved, maintaining a consistent environment after restoration.

It’s also worth noting that the concept of hidden files in Linux is different from Windows, where files are hidden via file attributes. In Linux, hiding is purely a naming convention; any file beginning with a dot is considered hidden. Commands like ls -a simply override this convention to display all files, making it a straightforward yet powerful tool for system inspection.

Question 106:

How do you view detailed file information in a human-readable format?

A) ls
B) ls -l
C) ls -lh
D) ls -a

Answer: C) ls -lh

Explanation:

-l provides detailed info; -h converts sizes to KB, MB, GB for readability.

In Linux, the ls command is one of the most fundamental tools for listing the contents of directories. By itself, ls displays filenames in a simple format, but it provides limited information about the files, such as type, size, permissions, ownership, or modification dates. To gain detailed insights, Linux provides several options, with -l (long listing) and -h (human-readable) being among the most commonly used. Understanding these options is essential for system administration, file management, and preparing for the LPIC-1 101 exam.

The -l option stands for “long listing format” and displays comprehensive information about each file in a columnar format. When you run ls -l, the output includes several critical pieces of information:

File Type and Permissions: The first column shows the file type (e.g., – for regular files, d for directories, l for symbolic links) and permissions for the owner, group, and others. For example, -rw-r–r– indicates read and write permissions for the owner, and read-only permissions for the group and others. This information is vital for security management and ensuring proper access controls.

Number of Hard Links: The second column indicates the number of hard links pointing to the file. This helps administrators track file references and understand storage utilization.

Owner and Group: The third and fourth columns display the username of the file owner and the group to which the file belongs. Ownership information is critical for enforcing user and group permissions.

File Size: The fifth column shows the size of the file in bytes by default. This helps administrators monitor large files and manage disk space.

Last Modification Date: The sixth column shows when the file was last modified, aiding in auditing and tracking changes.

Filename: The final column shows the actual name of the file or directory.

While -l provides detailed file information, file sizes are shown in bytes, which can be difficult to interpret for very large files. This is where the -h option comes into play. The -h option, short for “human-readable,” converts file sizes into readable units like KB, MB, or GB. For example, a file of size 1048576 bytes is displayed as 1.0M when using ls -lh. This makes it easier to quickly assess storage requirements without manually converting bytes to higher units.

Combining these options, as in ls -lh, produces a listing that is both detailed and easy to read. For instance, administrators can immediately see file permissions, ownership, modification time, and approximate size in a readable format. This combination is particularly useful for system auditing, backup verification, troubleshooting disk usage, and monitoring directories containing numerous files.

Question 107:

Which command shows the last login sessions of users?

A) who
B) w
C) last
D) uptime

Answer: C) last

Explanation:

Last reads /var/log/wtmp to show historical login sessions. Who and what show current sessions?Question 108: Which command shows the current memory usage in a human-readable format?
A) free -h
B) vmstat
C) top
D) df -h

Answer: A) free -h
Explanation: Displays RAM and swap usage in human-readable units. vmstat shows additional CPU/process info.

In Linux system administration, monitoring system performance and resource utilization is essential for maintaining stability and ensuring efficient operation, and commands like free -h, vmstat, top, and df -h are powerful tools that provide valuable insights into memory, CPU, and disk usage. Option A, free -h, is a straightforward command that displays the system’s memory usage in a human-readable format, with the -h option showing values in units like MB or GB for easier interpretation. It provides key details about total memory, used memory, free memory, buffers, and cache. For example, running free -h helps an administrator quickly determine if a system is running low on RAM or if the swap space is being heavily used, indicating potential performance issues. Option B, vmstat, short for virtual memory statistics, gives a more comprehensive view of the system’s performance by showing real-time statistics about processes, memory, paging, block I/O, system interrupts, and CPU activity. For instance, executing vmstat 2 provides continuous updates every two seconds, helping administrators identify bottlenecks such as excessive swapping or high I/O wait times. Unlike free -h, which only provides a snapshot of memory usage, vmstat gives a dynamic overview of how resources are being consumed over time, making it ideal for performance tuning and diagnosing system slowdowns. Option C, top, is one of the most commonly used and powerful commands for real-time process monitoring, displaying a continuously updating list of active processes along with CPU and memory usage percentages, process IDs (PIDs), and system load averages. With the top, administrators can identify which processes are consuming the most resources and, if necessary, terminate unresponsive or resource-hogging processes directly from the interface by pressing the k key. It also displays an overview of system uptime, task summary, and CPU utilization breakdown (user, system, idle, I/O wait), making it a vital command for live performance monitoring. Finally, Option D, df -h, focuses on disk space usage rather than memory or CPU. The -h option again makes the output human-readable, showing disk usage in megabytes or gigabytes. It lists all mounted file systems along with details such as total size, used space, available space, and mount points. For example, running df -h helps detect full or nearly full partitions, which can cause system instability or prevent new files from being written. It’s particularly important when managing servers that host databases or logs, as these systems can quickly fill up storage. In summary, free -h is best for checking memory and swap usage at a glance, vmstat provides detailed real-time system performance statistics, top delivers a live view of process activity and resource consumption, and df -h reveals storage utilization across file systems. When used together, these commands give system administrators a complete and holistic understanding of system health, allowing them to proactively identify problems, optimize performance, and ensure that the Linux environment remains stable, responsive, and efficient.

Question 109:

Which command follows a log file in real-time?

A) tail -n 50 -f file.log
B) tail -50 file.log
C) cat file.log
D) less file.log

Answer: A) tail -n 50 -f file.log

Explanation:

Displays the last 50 lines and updates the output as new lines are added.

In Linux system monitoring and troubleshooting, analyzing log files is one of the most essential administrative tasks, and commands such as tail -n 50 -f file.log, tail -50 file.log, cat file.log, and less file.log each serve specific purposes in viewing and managing logs effectively. Option A, tail -n 50 -f file.log, is the most powerful and dynamic option because it combines two capabilities: displaying the last 50 lines of a file (-n 50) and continuously following new entries in real time (-f). This means as the log file updates — for instance, when a web server writes new access logs or a system service reports new errors — those new lines appear instantly on the screen without having to rerun the command. This makes it indispensable for real-time monitoring of constantly updating files like /var/log/syslog, /var/log/auth.log, or /var/log/nginx/access.log, especially during live debugging or troubleshooting sessions. Option B, tail -50 file.log, performs a similar but static function: it displays only the last 50 lines of the log file and then exits. This is useful for quickly reviewing the most recent log entries without continuous monitoring. For example, after a system crash or application failure, running this command helps administrators quickly check the latest recorded messages to identify possible causes. However, it doesn’t automatically refresh as the file changes, so if new log entries are added later, the command must be rerun to see the updates. Option C, cat file.log, is the simplest and most basic command for viewing the contents of a file. It prints the entire content of file.log directly to the terminal in one continuous stream. While cat is fast and efficient for small files, it becomes impractical for large or continuously growing log files, as it will flood the terminal with data and provide no easy way to navigate or follow updates. Still, cat is valuable when you need to concatenate or quickly inspect small static files, such as configuration logs or short application logs. Option D, with fewer file.log, on the other hand, provides an interactive and scrollable viewing experience. It loads the log file in a paginated interface, allowing the user to scroll up or down, search for keywords using /searchterm, and navigate efficiently through very large files without loading them entirely into memory at once. This makes it less particularly suited for manually reviewing older or archived logs, where precise searching and navigation are needed rather than real-time monitoring. For example, an administrator can use less /var/log/dpkg.log to review the installation history of packages, searching for specific timestamps or package names. In summary, all four commands have distinct roles: cat file.log is for quick full-file display, tail -50 file.log for reviewing recent static entries, less file.log for interactive browsing and searching, and tail -n 50 -f file.log for live, continuous monitoring of log updates — making Option A the most effective for real-time troubleshooting while the others support different stages of log analysis in Linux system management.

Question 110:

Which command shows all groups on the system, including external sources?

A) groups
B) cat /etc/group
C) getent group
D) id

Answer: C) getent group

Explanation:

Queries both /etc/group and external sources like LDAP via NSS.

In Linux system administration, managing users and groups is a core aspect of maintaining system security and access control, and commands such as groups, cat /etc/group, getent group, and id are essential tools that help administrators view and verify user-group relationships. Option A, groups, is a simple yet powerful command used to display the groups to which a user belongs. When executed without any argument, it shows the group memberships of the current user, while specifying a username, such as groups john, displays all the groups associated with that particular user. For example, running groups might output fatima: fatima sudo adm, indicating that the user “fatima” belongs to the groups “fatima,” “sudo,” and “adm.” This is particularly useful for quickly checking whether a user has administrative privileges or access to shared resources. Option B, cat /etc/group, provides a more direct look into the group database file located in /etc/group, which stores all local group information on the system. Each line in this file follows the format group_name:x:GID:member_list, where x represents the password placeholder, GID is the group ID, and member_list includes usernames separated by commas. For instance, a line like sudo:x:27:fatima, john indicates that the “sudo” group has a group ID of 27 and includes “fatima” and “john” as members. Using cat allows administrators to view all group definitions at once, but it’s limited to local groups and doesn’t reflect information from network directories like LDAP. Option C, getent group, enhances this capability by retrieving group information from multiple sources as defined in the /etc/nsswitch.conf configuration file, which can include local files, NIS, or LDAP directories. This command ensures consistent and comprehensive results in environments that integrate both local and remote authentication systems. For example, running getent group developers will display information about the “developers” group regardless of whether it exists locally or is stored on a centralized authentication server. This makes getent invaluable in enterprise-level or multi-user network environments. Option D, id, provides a detailed summary of a user’s identity and associated group IDs (GIDs). It shows the user ID (UID), primary GID, and all supplementary groups that the user belongs to, along with both numeric and human-readable names. For example, id john might output uid=1001(john), gid=1001(john), groups=1001(john),27(sudo),1002(devops), offering clear visibility into the user’s access privileges and system identity. This command is particularly useful for verifying permissions and diagnosing issues where users cannot access certain files or directories due to group membership problems. In summary, while groups provides a quick overview of user group memberships, cat /etc/group reveals the complete structure of local group configurations, getent group extends this capability to include network-managed groups, and id offers a detailed breakdown of user and group identifiers. Together, these commands form a complete toolkit for managing and verifying user-group relationships in Linux, ensuring that access control, permissions, and security policies are properly enforced across both standalone and networked systems.

Question 111:

Which command sets or changes a user’s password?

A) passwd
B) usermod
C) useradd
D) groupadd

Answer: A) passwd

Explanation:

Updates the encrypted password in /etc/shadow for an existing user.

In Linux system administration, managing users and groups efficiently is crucial for maintaining system security, proper access control, and organization, and commands such as passwd, usermod, useradd, and groupadd serve as the core utilities for handling these tasks. Option A, passwd, is used to set, change, or manage user passwords. When an administrator runs passwd username, the system prompts for a new password, encrypts it, and stores it securely in the /etc/shadow file. This command can also be used to enforce password policies such as expiration dates, inactivity periods, or account locking, making it an essential security tool. For example, passwd -l john locks the account of user “john,” preventing login without deleting the account, while passwd -e john forces the user to change their password at the next login. Option B, usermod, is used to modify existing user accounts without deleting or recreating them. It can change user attributes such as the login shell, home directory, user ID, or group memberships. For instance, usermod -aG sudo john adds the user “john” to the “sudo” group, granting administrative privileges, while usermod -d /home/newjohn john changes the user’s home directory to /home/newjohn. This command ensures flexibility in managing accounts as organizational roles evolve, allowing administrators to update permissions, move users between departments, or adjust system access without disrupting their accounts. Option C, useradd, is the command used to create new user accounts on the system. It updates important system files such as /etc/passwd, /etc/shadow, and /etc/group to register the new user. For example, useradd -m -s /bin/bash john creates a user “john,” assigns them a home directory under /home/john, and sets Bash as their default shell. The -m flag ensures a home directory is created, while -s defines which shell the user will use. Without -m, no home directory is created automatically. This command is often followed by passwd john to assign a password to the new account, completing the setup process. Finally, Option D, groupadd, is used to create new groups on a Linux system, which are essential for managing shared access to files, directories, or resources. For example, groupadd developers creates a group called “developers” with a unique Group ID (GID). Users can then be added to this group using usermod a-aGdevelopers username, allowing multiple users to share permissions and collaborate on common files. Groups simplify permission management by allowing administrators to assign access based on roles rather than individual users. In summary, passwd secures user accounts through password management, usermod adjusts or updates user account attributes, useradd creates new user accounts, and groupadd organizes users into logical collections for efficient permission management. Together, these four commands form the foundation of Linux user and group administration, ensuring that systems remain secure, organized, and easy to manage. Understanding their individual purposes and how they interact with system configuration files like /etc/passwd, /etc/shadow, and /etc/group is essential for any Linux administrator responsible for maintaining a stable and secure multi-user environment.

Question 112:

Which command modifies attributes of an existing user account?

A) useradd
B) usermod
C) passwd
D) groupadd

Answer: B) usermod

Explanation:

Can change login shell, home directory, groups, and expiration dates, but cannot create a user.

In Linux system administration, managing users and groups is a core task for ensuring system security, proper access control, and organized resource management, and commands such as useradd, usermod, passwd, and groupadd form the fundamental toolkit for these operations. Option A, useradd, is the primary command for creating new user accounts. It allows administrators to define essential attributes of a user, including the home directory, default shell, user ID (UID), and initial group membership. For instance, the command useradd -m -s /bin/bash john creates a new user named “john,” sets up a home directory at /home/john, and assigns Bash as the default shell. The -m option ensures the home directory is automatically created, while the -s option specifies the login shell. Once the user account is created, it is often necessary to secure it with a password, which is where Option C, passwd, comes into play. The passwd command is used to set or change a user’s password, updating the encrypted password in the /etc/shadow file. For example, executing passwd john prompts the administrator to enter and confirm a new password for “john,” ensuring secure authentication. passwd can also enforce password policies, such as expiration dates or account locks, which are critical for maintaining system security in multi-user environments. Option B, usermod, is used to modify existing user accounts without having to recreate them. It allows administrators to change attributes like login shells, home directories, group memberships, or even the username itself. For example, usermod -aG sudo john adds the user “john” to the “sudo” group, granting administrative privileges, while usermod -d /home/newjohn john changes the user’s home directory to /home/newjohn. This flexibility ensures that as user roles evolve or responsibilities change, accounts can be updated efficiently without disrupting existing access or files. Option D, groupadd, is used to create new groups on the system, which helps organize users and manage shared access to files and resources. For example, groupadd developers creates a group named “developers” with a unique group ID (GID), and users can later be added to this group using usermod –aG developers username. Group management simplifies permission handling by allowing administrators to assign rights collectively rather than individually. Together, these four commands enable complete user and group management: useradd creates accounts, passwd secures them with passwords, usermod updates account attributes as needed, and groupadd organizes users into logical groups for access control. Understanding how these commands interact with system files such as /etc/passwd, /etc/shadow, and /etc/group is essential for Linux administrators, ensuring secure, organized, and maintainable multi-user environments. Mastery of these tools not only supports day-to-day administration but also underpins effective security practices, permission management, and efficient resource allocation across a Linux system.

Question 113:

Which command switches to another user interactively?

A) sudo
B) su
C) usermod
D) passwd

Answer: B) su

Explanation:

Starts a new shell as the target user. Sudo executes commands with elevated privileges without switching the session.

In Linux system administration, managing user privileges and authentication is crucial for system security and effective administrative control, and commands such as sudo, su, usermod, and passwd are fundamental tools for achieving these objectives. Option A, sudo, stands for “superuser do” and allows a permitted user to execute a command with elevated privileges without logging in as the root user. It provides a controlled and auditable way to perform administrative tasks, such as installing software, editing system configurations, or restarting services, while maintaining accountability through log files like /var/log/auth.log. For example, running sudo apt update executes the package update command with root privileges, even if the logged-in user is not the root account. Sudo is particularly important for systems with multiple administrators, as it allows fine-grained control over which commands each user can execute. Option B, su, which stands for “substitute user” or “switch user,” allows a user to log in as another user, most commonly root, within a shell session. By executing su – and providing the root password, an administrator can switch to the root account, gaining full privileges to execute commands without prefixing them with sudo. Unlike sudo, which can be configured for individual commands, su provides a persistent root shell until the session is exited, which can be useful for performing multiple administrative tasks consecutively but may pose higher security risks if not managed properly. Option C, usermod, is used to modify existing user accounts and their privileges. For example, running usermod –aG sudo john adds the user “john” to the sudo group, effectively granting him the ability to run commands with elevated privileges via sudo. This command is essential for controlling which users can obtain administrative rights without giving them full root access directly, thereby enabling a more secure and auditable environment. Option D, passwd, is used to set or change a user’s password, ensuring that accounts remain secure and accessible only to authorized individuals. It updates the encrypted password stored in /etc/shadow, and can also enforce password policies, such as expiration or minimum length. For example, executing passwd john allows the administrator to assign or reset the password for the user “john,” which is a prerequisite for both su and sudo operations since proper authentication is required to gain elevated access. Together, these four commands provide a comprehensive framework for managing user privileges and authentication in Linux: sudo offers controlled, auditable access to administrative commands, su allows full user switching for tasks requiring persistent elevated access, usermod manages group memberships and privileges to grant or revoke administrative rights, and passwd secures accounts by managing passwords. Mastering these commands enables administrators to maintain a secure, well-organized, and auditable Linux environment, ensuring that only authorized users can perform critical system tasks while minimizing security risks associated with full root access.

Question 114:

Which file stores user account metadata like UID, GID, home directory, and shell?

A) /etc/passwd
B) /etc/shadow
C) /etc/group
D) /etc/login.defs

Answer: A) /etc/passwd

Explanation:

Contains account details. Passwords are stored in /etc/shadow for security.

In Linux systems, user and group management rely heavily on a set of critical configuration files, each serving a specific purpose in defining accounts, security, and access control, and commands or operations often interact with files such as /etc/passwd, /etc/shadow, /etc/group, and /etc/login.defs. Option A, /etc/passwd, is one of the most fundamental files in Linux, containing essential user account information. Each line in this file represents a single user and includes fields such as the username, an “x” placeholder for the password (which points to /etc/shadow for security), the user ID (UID), the primary group ID (GID), a comment or description field, the user’s home directory, and the default login shell. For example, a line like john:x:1001:1001:John Doe:/home/john:/bin/bash defines a user “john” with UID 1001, primary GID 1001, home directory /home/john, and Bash as the default shell. This file is readable by all users but does not store actual password hashes, which keeps it secure from unauthorized access. Option B, /etc/shadow, complements /etc/passwd by storing encrypted passwords and password-related metadata securely. Unlike /etc/passwd, /etc/shadow is readable only by the root user, which enhances security by preventing ordinary users from accessing password hashes. Each line contains the username, encrypted password, last password change date, password expiration information, and account locking details. For example, a line like john:$6$abc123…:19000:0:99999:7::: indicates the encrypted password for “john,” when it was last changed, and policy-related attributes for password aging and expiration. Option C, /etc/group, contains group definitions, which allow administrators to manage collections of users who share permissions or responsibilities. Each line in this file includes the group name, a password placeholder, the group ID (GID), and a comma-separated list of member usernames. For example, developers:x:1002:john,fatima defines a group “developers” with GID 1002 and members “john” and “fatima.” This file is essential for managing shared access to files and directories, as permissions can be assigned at the group level rather than individually, simplifying administration and enforcing consistent access control. Option D, /etc/login.defs, defines default configuration settings for user account creation and authentication policies. It includes parameters such as the default home directory base, UID and GID ranges for normal and system users, password aging policies, and security settings like minimum password length or expiration. For example, entries in /etc/login.defs may specify UID_MIN 1000 and UID_MAX 60000 to control the range of user IDs assigned automatically by commands like useradd. This file ensures that user and group management remains consistent across system operations and that security policies are applied uniformly. Together, these four files form the backbone of Linux user and group management: /etc/passwd defines the account and login details, /etc/shadow securely stores passwords, /etc/group organizes users into groups for permission management, and /etc/login. defs sets system-wide defaults and policies that govern user creation and authentication. Understanding their structure, function, and interrelation is essential for administrators to manage users securely, assign appropriate access, enforce password policies, and maintain a stable, organized multi-user environment.

Question 115:

Which file contains hashed passwords and password aging information?

A) /etc/passwd
B) /etc/shadow
C) /etc/group
D) /etc/login.defs

Answer: B) /etc/shadow

Explanation:

 Accessible only to root; contains encrypted passwords and aging policies.

Question 116:

What does chmod 755 file do?

A) Changes ownership
B) Changes permissions to rwxr-xr-x
C) Locks the file
D) Changes group

Answer: B) Changes permissions to rwxr-xr-x

Explanation:

The Owner can read/write/execute; the group and others can read and execute. Ownership remains unchanged.

Question 117:

Which command shows all block devices in a tree format with mount points?

A) df -h
B) lsblk
C) mount
D) du -sh

Answer: B) lsblk

Explanation:

Displays all storage devices, partitions, and their mount points in a hierarchical format.

Question 118:

Which command shows mounted filesystems and their usage in a human-readable format?

A) lsblk
B) df -h
C) du -sh
D) mount

Answer: B) df -h

Explanation:

Displays usage statistics for mounted filesystems. lsblk shows devices, and du shows directory sizes.

Question 119:

Which file defines system-wide defaults for user account creation?

A) /etc/passwd
B) /etc/shadow
C) /etc/login.defs
D) /etc/group

Answer: C) /etc/login.defs

Explanation:

Defines UID/GID ranges, password aging, and other account defaults.

Question 120:

Which command allows passwordless execution of specific commands as root?

A) usermod
B) passwd
C) /etc/sudoers configuration
D) /etc/group

Answer: C) /etc/sudoers configuration

Explanation:

Editing /etc/sudoers with NOPASSWD: allows specific commands to be run without entering a password.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!