Exam Details

  • Exam Code
    :XK0-004
  • Exam Name
    :CompTIA Linux+ Certification
  • Certification
    :CompTIA Certifications
  • Vendor
    :CompTIA
  • Total Questions
    :516 Q&As
  • Last Updated
    :Aug 23, 2023

CompTIA CompTIA Certifications XK0-004 Questions & Answers

  • Question 241:

    An administrator has written the following Bash script:

    All necessary files exist in the correct locations. However, when the administrator executes /home/user/ test.sh the following error is received:

    No such file or directory

    Which of the following is the MOST likely cause of the error?

    A. The shebang points to the wrong path.

    B. The script is not executable.

    C. The formatting of the file is incorrect.

    D. Nslookup is not installed.

  • Question 242:

    A configuration management tool running every minute is enforcing the service HTTPd to be started. To perform maintenance, which of the following series of commands can be used to prevent the service from being started?

    A. systemctl stop httpd andand systemctl mask httpd

    B. systemctl disable httpd andand systemctl mask httpd

    C. systemctl stop httpd andand systemctl hide httpd

    D. systemctl disable httpd andand systemctl hide httpd

  • Question 243:

    A Linux systems administrator installed a new web server, which failed while attempting to start. The administrator suspects that SELinux is causing an issue and wants to temporarily put the system into permissive mode. Which of the following would allow the administrator to accomplish this?

    A. echo SELINUX=PERMISSIVE >> /etc/sysconfig/selinux

    B. setenforce 0

    C. sestatus 0

    D. chcon httpd_sys_content_t /var/

  • Question 244:

    All users are reporting that they cannot connect to the SFTP server. The administrator runs a scan:

    Which of the following would allow the administrator to fix the problem?

    A. Allow SFTP connections on port 22 using /etc/sysconfig/iptables.

    B. Allow SFTP connections on port 20 and 21 using /etc/sysconfig/iptables.

    C. Allow SFTP connections on port 25 using /etc/sysconfig/iptables.

    D. Allow SFTP connections on port 1456 using /etc/sysconfig/iptables.

  • Question 245:

    An analyst is trying to determine which public IP addresses are managed by Company A, but the script is not working correctly.

    Which of the following explains what is wrong with the script?

    A. $(cat ip-list.txt) should be changed to `cat ip-list.txt` in the for statement.

    B. The for should be changed to while in the loop.

    C. The > should be changed to 2> in the do statement.

    D. The -ne flag should be changed to -eq in the if statement.

  • Question 246:

    A user wants to list the lines of a log, adding a correlative number at the beginning of each line separated by a set of dashes from the actual message. Which of the following scripts will complete this task?

    A. Option A

    B. Option B

    C. Option C

    D. Option D

  • Question 247:

    A junior systems administrator created a new filesystem /dev/sda1 with mountpoint /data and added it to the /etc/fstab for auto-mounting. When the systems administrator tries to mount the file system, the system refuses. Given the output below:

    Which of the following steps is necessary?

    A. Change the filesystem from /dev/sda1 to /dev/sda2 and reboot.

    B. Change the options to auto,dev,sync,rw,nosuid and run the mount -a command.

    C. Change the mount point to data and reboot.

    D. Change the dump column to 1 and run the mount -a command.

  • Question 248:

    A member of the production group issues the following command:

    echo "Monday through Friday" > /production_docs/days

    The command fails to execute, so the user obtains the following output:

    drwxr--r-- root production 0 Jun 16 2018 production

    -rw-r--r-- production production 4096 Jun 14 2018 days

    Which of the following commands should the user execute to BEST fix the issue?

    A. chmod g+w production to change the permissions on the days file

    B. chgrp root production_docs/days to change the group ownership of the production_docs/ days file

    C. chmod g+S production to set the GUID on the production_docs directory

    D. chown production to change the ownership of the production_docs directory

  • Question 249:

    A Linux administrator has installed a web application firewall in front of a web server running on HTTP port 8080 and successfully started the HTTP server. However, after opening the application URL in an Internet browser, the administrator discovered that the application does not work. The administrator performed the following diagnostic steps:

    Output of sysctl -a command:

    Output of iptables -L command:

    Output of netstat -nltop | grep "8080": Which of the following is the NEXT step the administrator should perform to permanently fix the issue at the kernel level?

    A. sysctl -w net.ipv4.ip_forward=1 then run sysctl -w /etc/sysctl.conf to enable the change

    B. Edit /etc/sysctl.conf file and add net.ipv4.ip_forward = 1 then run sysctl -p /etc/ sysctl.conf to enable the change

    C. Add iptables rule iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j then restart httpd daemon

    D. Add iptables rule iptables -A FORWARD-m state --state NEW -p tcp --dport 8080 -j ACCEPT then restart httpd daemon

  • Question 250:

    A junior Linux administrator needs to ensure a service will start on system boot. Which of the following commands should be used to accomplish this task?

    A. chkconfig on

    B. systemctl bootup

    C. service enable

    D. crontab install

Tips on How to Prepare for the Exams

Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only CompTIA exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your XK0-004 exam preparations and CompTIA certification application, do not hesitate to visit our Vcedump.com to find your solutions here.