Real-World Linux Administration Scenarios Quiz Quiz

Explore essential Linux administration principles with practical scenarios covering user management, permissions, networking, troubleshooting, and system security. This quiz is designed to help professionals reinforce their skills and improve problem-solving techniques for real-world Linux environments.

  1. Managing User Access

    A user reports they cannot log in after a recent password change on their Linux system. Which command is best suited to unlock the account if it has been locked due to too many failed login attempts?

    1. passwd -u username
    2. useradd -u username
    3. usermod -l username
    4. chmod u+x username

    Explanation: The 'passwd -u username' command is used to unlock a user account that has been locked, often due to repeated failed login attempts. The 'usermod -l' command is for renaming users, which does not address locked accounts. 'chmod u+x' changes file permissions and is not related to account status. 'useradd -u' is used for creating new users with a specific user ID, not for unlocking accounts.

  2. File Permissions Troubleshooting

    After moving a shared script to /usr/local/bin, users report they receive a 'Permission denied' error when trying to execute it. What is the most likely command to resolve this issue?

    1. chmod +x /usr/local/bin/script
    2. rm /usr/local/bin/script
    3. chown nobody /usr/local/bin/script
    4. mv /usr/local/bin/script /tmp/

    Explanation: The 'chmod +x' command adds execute permissions to the script, allowing users to run it. Changing ownership with 'chown nobody' does not address execute permissions and may make the problem worse. Deleting the script with 'rm' removes access altogether. Moving the file to /tmp/ only relocates the problem without fixing permissions.

  3. Network Diagnostics

    A Linux server cannot reach an internal web service by hostname, but works when using the service’s IP address. Which command would you use first to check the system's DNS resolution?

    1. df -h
    2. lsmod servicename
    3. nslookup servicename
    4. ping 127.0.0.1

    Explanation: Using 'nslookup servicename' helps determine if the DNS is resolving the hostname correctly. The 'ping 127.0.0.1' command only tests local network stack functionality, not DNS resolution. 'df -h' checks disk space and is unrelated, while 'lsmod' lists loaded kernel modules and does not pertain to DNS issues.

  4. Service Availability Troubleshooting

    A web server process is running but users report no access from remote systems. Which command is most appropriate to verify if the correct network port is listening?

    1. ss -tuln
    2. whoami
    3. cat /etc/group
    4. cp /var/log/syslog /tmp/

    Explanation: The 'ss -tuln' command lists open ports and their listening services, directly helping identify if the expected web port is active. Copying log files with 'cp' does not provide information about open ports. Viewing groups with 'cat /etc/group' and checking the current user with 'whoami' do not address port listening or network service status.

  5. Security and File Integrity

    An administrator wants to ensure that all files in the /var/www directory are owned by the web service user. Which command best achieves this goal?

    1. find /var/www -delete
    2. chown -R webuser:webgroup /var/www
    3. kill -9 webuser
    4. chmod 755 /var/www

    Explanation: The 'chown -R webuser:webgroup /var/www' command recursively sets ownership for all files in the directory to the correct user and group, addressing security and access requirements. 'chmod 755' only changes permissions but not ownership. 'kill -9 webuser' is invalid syntax for terminating processes and does not relate to files. 'find /var/www -delete' would remove the contents, which is not the intent.