Linux + Exam C-CompTia 005
A systems administrator created a user cron to run a scheduled database backup cronjob on the server at 1 a.m. every day. The following is the cronjob syntax: 0 1 * * * /bin/sh backup.sh The backups, however, are not being created. When checking the crontab file, the administrator sees the following error: /var/spool/cron/crontab/cron: Permission denied Which of the following will permit the cronjob to execute? A. Creating the file cron.allow and adding user cron to it B. Giving cron ownership of the file /usr/bin/crontab C. Running sudo cron restart to activate the cronjob D. Running sudo crontab -u cron -e to edit the file with sudo
A. Creating the file cron.allow and adding user cron to it
A systems administrator is customizing a new Linux server. Which of the following settings for umask would ensure that new files have the default permissions of -rw-r--r--? A. 0017 B. 0027 C. 0038 D. 0640
B. 0027
A Linux administrator is tasked with moving files in a database server. The administrator must not overwrite any existing files. Which of the following commands would indicate that the file already exists? A. mv-ifilename/tmp/backup B. mv-bfilename/tmp/backup C. mv-nfilename/tmp/backup D. mv-ffilename/tmp/backup
A. mv-ifilename/tmp/backup
A Linux administrator would like to measure possible packet loss between a workstation and a remote web application that is running on port 443. Which of the following would be the best command for the administrator to use to display this information? A. ping -c 50 <remote server IP> B. tcpdump -p 443 <remote server IP> C. mtr -T -P 443 <remote server IP> D. traceroute -p 443 <remote server IP>
A. ping -c 50 <remote server IP>
Which of the following commands is used to tune kernel parameters? A. sysctl B. ss C. mkinitrd D. lsof
A. sysctl
A Linux administrator updated the configuration file for the httpd web service. The administrator needs to apply the updated changes to the service without interrupting any running sessions. Which of the following commands should the administrator run to accomplish this task? A. systemctl reload httpd B. systemctl restart httpd C. systemctl status httpd D. systemctl mask httpd
A. systemctl reload httpd
An administrator made a change to a system's network configuration. Which of the following best represents what the administrator should do to have the new configuration take effect? A. systemctl restart networkd B. systemctl enable networkd C. systemctl status networkd D. systemctl isolate networkd
A. systemctl restart networkd
An administrator is provisioning an Apache web server. When the administrator visits the server website, the browser displays a message indicating the website cannot be reached. Which of the following commands should the administrator use to verify whether the service Is running? A. systemctlstatus httpd B. systemctlmask httpd C. systemctlreload httpd D. systemctlrestart httpd
A. systemctlstatus httpd
A Linux administrator is enabling root log-in over SSH on a server. Which of the following combinations of files and parameters should the administrator modify to accomplish this task? A. /etc/ssh/ssh_config - PermitRootLogin B. /etc/ssh/ssh_config - AllowRootLogin C. /etc/ssh/sshd_config - PermitRootLogin D. /etc/ssh/sshd_config - AllowRootLogin
C. /etc/ssh/sshd_config - PermitRootLogin
A Linux administrator needs to forward port 8000 on a remote server to port 8000 on a local server. Which of the following commands should the administrator run on the local server to achieve this goal? A. firewall-cmd --add-forward-port=port=8000=tcp=8000=remote B. iptables -A FORWARD -m state -p tcp -d remote --dport 9000 -j accept C. ssh -R 8000:localhost:9000 remote D. socat TCP4-LISTEN:8000,fork TCP4:remote:8000
C. ssh -R 8000:localhost:9000 remote
A systems administrator is tasked with configuring a repository on an RPM-based Linux system. Which of the following need to be reviewed and modified? (Select two). A. /etc/yum.conf B. /etc/apt/sources.list.d C. /etc/pam.d D. /etc/apt.conf E. /etc/yum.repos.d F. /etc/ssh/ssh_config
A. /etc/yum.conf E. /etc/yum.repos.d
A Linux systems administrator is working to obtain the installed kernel version of several hundred systems. Which of the following utilities should the administrator use for this task? A. Ansible B. Git C. Docker D. Bash
A. Ansible
A Linux administrator created a virtual clone of a physical server and would like to remove any existing entries related to SSH keys from outside entities on the virtual clone. Which of the following files should the administrator remove? (Select two). A. ~/.ssh/authorized_keys B. ~/.ssh/known_hosts C. /etc/ssh/ssh_config D. ~/.ssh/config E. /etc/ssh/sshd_config F. /etc/ssh/ssh_host_rsa_key.pub
A. ~/.ssh/authorized_keys B. ~/.ssh/known_hosts
A Linux administrator logs into a system and identifies that an important backup has started. The backup process is consuming a considerable amount of CPU time but needs to continue. Which of the following should the administrator use to reduce the impact this process has on other services? A. renice -n 15 -p <backup pid> B. nice -n 15 -p <backup pid> C. renice -n -15 -p <backup pid> D. nice -n -15 -p <backup pid>
A. renice -n 15 -p <backup pid>
A Linux administrator needs to check extended permissions applied to the directory test. Which of the following commands should the administrator use to help with this task? A. getsebool test/ B. getenforce test/ C. getfacl test/ D. ls -al test/
C. getfacl test/
A Linux administrator needs to remove all local firewall rules on a Linux system. Which of the following commands should the administrator run? A. iptables -D B. iptables -L C. iptables -F D. iptables -A
C. iptables -F
A Linux administrator is troubleshooting an SSHD issue on a server. Users are receiving error messages stating the connection is refused. Which of the following commands should be used to verify whether the service is listening? A. nslookup B. route C. netstat D. ifconfig
C. netstat
A network administrator issues the dig ww. comptia. org command and receives an NXDOMAIN response. Which of the following files should the administrator check first? A. /etc/resolv.conf B. /etc/hosts C. /etc/sysconfig/network-scripts /etc/nsswitch.conf
A. /etc/resolv.conf
A network administrator issues the dig www.foo.com command and receives an NXDOMAIN response. Which of the following files should the administrator check first? A. /etc/resolv.conf B. /etc/hosts C. /etc/sysconfig/network-scripts D. /etc/nsswitch.conf
A. /etc/resolv.conf
A server administrator has scheduled a cron job to run YUM updates on all servers without manual intervention, but kernel packages must be excluded from the updates at all times. Which of the following configuration files needs to be modified to make these changes persistent? A. /etc/yum.conf B. /etc/dnf/dnf.conf C. /etc/yum/pluginconf.d/packages.conf D. /etc/yum.repo.d/kernel.repo
A. /etc/yum.conf
Which of the following directories contains binaries that only a root user should run? A. /sbin B. /bin C. /root D. /lib
A. /sbin
A Linux administrator deployed a large-scale application service as a containerized pod. The Linux administrator needs to continually send the application's log file to the company's central log store. Which of the following should the Linux administrator do to efficiently perform this task? A. Configure a sidecar to perform log shipping B. Run docker exec to access the logs within the container C. Execute docker inspect and run a log rsync replication D. Set up a custom task scheduler via kubectl
A. Configure a sidecar to perform log shipping
The setfacl -m u:Oliver:rwx /cloud_users command modifies the ACL (Access Control List) for the directory cloud_users, granting the user Oliver read, write, and execute permissions. This is the correct syntax for assigning specific permissions to a user. QUESTION 6 A security team discovers that a web server has been running with elevated privileges and identifies it as a security violation. Which of the following items needs to be added to the webserver.service file to remediate the issue? A. In the [Service] section of the webserver.service file, add User=comptia. B. In the [Unit] section of the webserver.service file, add AllowIsolate=true. C. In the [Install] section of the webserver.service file, add WantedBy=single.target. D. Add After=network.target to the [Install] section of the webserver.service file.
A. In the [Service] section of the webserver.service file, add User=comptia.
Linux system users report that over the past few months, a server has stopped responding at least twice each day. Every time this happens, the users have to restart the server to recover it. A systems administrator diagnosing the issue collects the following outputs: csharp Output 1 [Tue Aug 31 16:36:42 2021] oom-killer invoked by java: gfp_mask=0x280da2 order=0, oom_score_adj=0 [Tue Aug 31 16:36:42 2021] java cpuset=/ mems_allowed=0 makefile Output 2 [root@server]# free -m total used free shared buff/cache available Mem: 15819 15026 174 92 619 134 Swap: 0 0 0 Which of the following is the best permanent resolution for the system? A. More memory resources B. More CPU resources C. More network bandwidth D. Extended root filesystem
A. More memory resources
A Linux administrator is investigating the reason a systemd timer is not running every night at midnight. The administrator sees the following unit file: [Unit] Description=Execute backup every day at midnight [Timer] OnCalendar=--01 00:00:00 Unit=backup.service RandomizedDelaySec=10800 [Install] WantedBy=multi-user.target Which of the following modifications should the administrator make in the unit file? (Select two). A. Remove RandomizedDelaySec=10800. B. Add WakeSystem=Midnight. C. Change OnCalendar to 00:00:00. D. Add OnCalendar=--* daily. E. Add AccuracySec=1. F. Remove OnCalendar=--01 00:00:00.
A. Remove RandomizedDelaySec=10800.
A systems administrator identifies multiple processes in a zombie state. Which of the following signals would be best for the administrator to send to the PPID? A. SIGTERM B. SIGHUP C. SIGQUIT D. SIGSTOP
A. SIGTERM
Users are reporting that a Linux server is responding slowly. A systems administrator troubleshooting the server issue sees the following iostat output, with %iowait at 50.38. Which of the following is most likely the issue? A. The CPU is mostly waiting for I/O operations. B. / filesystem does not have enough storage allocated. C. /var filesystem is almost full. D. The CPU capacity is inadequate.
A. The CPU is mostly waiting for I/O operations.
While troubleshooting server issues, a Linux systems administrator obtains the following output: yaml total used free shared buff/cache available Mem: 3736 3538 33 2 48 25 Swap: 2047 1824 223 Which of the following best describes the state of the system? A. The system has consumed the system memory and swap space B. The system has enough free memory space C. The system has swap disabled D. The system has allocated enough buffer space
A. The system has consumed the system memory and swap space
A Linux administrator is implementing a CI/CD process for the company's internal accounting web application. Which of the following best defines the purpose of this process? A. To automate the process of building, testing, and deploying application components B. To perform security penetration tests on deployed applications to identify vulnerabilities C. To formalize the approval process of application releases and configuration changes D. To leverage code to document the infrastructure, configurations, and dependencies
A. To automate the process of building, testing, and deploying application components
An administrator wants to execute a long-running script in the terminal while troubleshooting another issue. Which of the following options will achieve this goal? A. bash script.sh & B. source script.sh C. sh script.sh | jobs D. nice -10 ./script.sh
A. bash script.sh &
A systems administrator is cloning a system partition /dev/sda1 to /dev/sdc1. Which of the following commands would allow the administrator to accomplish this task most efficiently? A. dd if=/dev/sda1 of=/dev/sdc1 B. cat /dev/sda1 > /dev/sdc1 C. cp -R /dev/sda1 /dev/sdc1 D. rsync -av /dev/sda1 /dev/sdc1
A. dd if=/dev/sda1 of=/dev/sdc1
A Linux administrator needs to expose port 9000 for a container to listen during runtime. The Linux administrator creates a Dockerfile with the following entries: sql FROM node:9-alpine WORKDIR /usr/src/app COPY package.json ./ RUN npm install COPY . . EXPOSE 9000 CMD ["npm", "start"] Which of the following commands should the administrator use to accomplish this task? (Select two). A. docker build -t Test-Container B. docker tag Test-Container C. docker inspect Test-Container D. docker run -p 5000:80 Test-Container E. docker push Test-Container F. docker run -p 80:9000 Test-Container
A. docker build -t Test-Container F. docker run -p 80:9000 Test-Container
An operations engineer is planning to start a container running a PostgreSQL database. The engineer wants the container to start automatically at system startup, mount the /home/db directory as /var/lib/ postgresql inside the container, and expose port 5432 to the OS. Which of the following commands should the engineer run to achieve this task? A. docker run -d --restart always -p 5432:5432 -v /home/db:/var/lib/postgresql postgresql:12 B. docker run -d --restart -p 5432:5432 --volume /var/lib/postgresql:/home/db postgresql:12 C. docker run -d --attach --platform 5432:5432 --volume /home/db:/var/lib/postgresql postgresql:12 D. docker run -d --init --restart --publish 5432:5432 --workdir /home/db:/var/lib/postgresql postgresql:12
A. docker run -d --restart always -p 5432:5432 -v /home/db:/var/lib/postgresql postgresql:12
A user is cleaning up a directory because it has more than 100,000 files that were generated from an experiment. When the user tries to remove the unneeded experiment files, the user receives an error: arduino cannot execute [Argument list too long] Which of the following should the user execute to remove these files? A. find . -name "experiment*.txt" -exec rm "{}" ; B. rm -rf experiment*.txt C. rm --force experiment*.txt D. for i in experiment*.txt; do find . -name $i -exec rmdir "{}" ; done
A. find . -name "experiment*.txt" -exec rm "{}" ;
A DevOps engineer pushed the updated configuration to an existing branch of a remote Git repository. Which of the following commands should the Linux administrator use to obtain these configuration changes? A. git pull B. git log C. git fetch D. git checkout main
A. git pull
A Linux systems administrator needs to compress a file named passwords.txt. The compressed file should be saved as passwords.txt.gz. Which of the following commands should the administrator use to accomplish this task? A. gzip -c passwords.txt > passwords.txt.gz B. gzip -d passwords.txt | passwords.txt.gz C. gzip -n passwords.txt > passwords.txt.gz gzip-npasswords.txt<passwords.txt.gz
A. gzip -c passwords.txt > passwords.txt.gz
A Linux administrator is configuring a log collector agent to monitor logs in /var/log/collector. The agent is reporting that it cannot write to the directory. The agent runs as the logger user account. The administrator runs a few commands and reviews the following output: makefile Output 1: drwxr-xr-x. 1 root root 0 Oct 20:13 collector Output 2: file: /var/log/collector owner: root group: root user::rwx group::r-x mask::rwx other::r-x Output 3: uid=1010(logger) gid=1010(monitor) groups=1010(monitor) Which of the following is the best way to resolve the issue? A. setfacl -Rm u:logger:rwx /var/log/collector B. usermod -aG root logger C. chmod 644 /var/log/collector D. chown -R logger/var/log
A. setfacl -Rm u:logger:rwx /var/log/collector
browser to enter the final configuration information. The administrator determines the server is running in multi-user mode. The administrator verifies that a web browser is installed on the server and that it has a display manager installed. Which of the following commands will best allow the administrator to temporarily use the web browser on the server? A. sudo systemctl isolate graphical.target B. sudo systemctl set-default runlevel5.target C. sudo systemctl restart gdm D. sudo systemctl --no-wall rescue
A. sudo systemctl isolate graphical.target
Which of the following commands should a technician use to create an administrative account for the username Joe? A. sudo useradd -G wheel joe B. sudo useradd joe; sudo passwd -l joe C. sudo useradd joe; sudo cat key.pem > ~/.ssh/authorized_keys D. sudo useradd joe; groupadd admin joe
A. sudo useradd -G wheel joe
A hardened physical Linux system allows regular, unprivileged users to remotely connect to the server using SSH only. No sudo tool has been installed. Which of the following should the Linux administrator use to perform administrative tasks on this host? (Select two). A. Create an SSH key and copy it to the remote server to allow passwordless login B. Access the server's physical console and use the root user's password to log in C. Install the telnet server on this system to be able to use a root account D. Use the su command and enter the root user's password E. Install the sudo command using the unprivileged user's account F. Add the user to the wheel group
B. Access the server's physical console and use the root user's password to log in D. Use the su command and enter the root user's password
A Linux administrator is creating a user that can run the FTP service but cannot log in to the system. The administrator sets /bin/false as a login shell for the user. When the user tries to run the FTP service, it is rejected with an "invalid shell: / bin/false" message. Which of the following is the best way to resolve the issue? A. Change ownership of /bin/false to the FTP user B. Add /bin/false entry to the /etc/shells file C. Make /bin/false an executable file D. Change the user's default shell to /bin/bash
B. Add /bin/false entry to the /etc/shells file
Joe, a user, is unable to log in to the system. The Linux administrator checks the /etc/passwd file and reviews the following output: Joe:x:1002:1002::/home/Joe:/sbin/nologin Which of the following should the administrator do to fix this issue? A. Remove the x entry in the /etc/passwd file for Joe B. Change the /sbin/nologin entry to /bin/sh for Joe C. Issue the usermod -l Joe command D. Ensure that a corresponding entry is in the /etc/shadow file for Joe
B. Change the /sbin/nologin entry to /bin/sh for Joe
While troubleshooting server issues, a Linux systems administrator obtains the following output: [rootGhost ~]# totalfree -m usedfreesharedbuf f/cache available Mem:373635988824829 Swap:20471824223 Which of the following best describes the state of the system? A. The system has consumed the system memory and swap space. B. The system has enough free memory space. C. The system has swap disabled. D. The system has allocated enough buffer space.
B. The system has enough free memory space.
A security analyst is monitoring the network to identify latency or slowdowns during a vulnerability scan. Which of the following functions will best achieve this? bash function x() { info=$(ping -c 1 $1 | awk -F "/" 'END {print $5}') echo "$1 | $info" } A. function x() { info=$(dig $(dig -x $1 | grep ptr | tail -n 1 | awk -F ".in-addr" '{print $1}').origin.asn.cymru.com TXT +short); echo "$1 | $info" } B. function x() { info=$(ping -c 1 $1 | awk -F "/" 'END {print $5}'); echo "$1 | $info" } C. function x() { info=$(nc -m 40 $1 | awk 'END {print $1}'); echo "$1 | $info" } D. function x() { info=$(geoiplookup $1); echo "$1 | $info" }
B. function x() { info=$(ping -c 1 $1 | awk -F "/" 'END {print $5}'); echo "$1 | $info" }
The gzip command with the -c flag outputs the compressed data to standard output, which can then be redirected to create a .gz file. This approach maintains the original file while creating a compressed version. Reference: Gzip Command Documentation QUESTION 37 The MySQL database process that was running on a Linux server suddenly stopped, and the process was killed. Which of the following commands can help identify whether this issue was produced by the OOM killer? A. grep /proc/oom_score B. grep -ir "out of memory" /var/log C. cat /var/run/initramfs/overlayroot.log | grep "out of memory" D. cat /sys/block/loop0/events
B. grep -ir "out of memory" /var/log
A technician just fixed a few issues in some code and is ready to deploy the code into production. Which of the following steps should the technician take next? A. Create a new branch using git checkout. B. Perform a git clone to pull main down. C. Create a git pull request to merge into main. D. Perform a git pull to update the local copy of the code.
C. Create a git pull request to merge into main.
A Linux administrator wants a permission bit on a shared folder that allows only the owner of the file within that directory or the root user to delete or rename the file. Which of the following commands will help achieve this goal? A. chmod u-w /directory/ B. chmod a-r /directory/ C. chmod o-t /directory/ D. chmod +t /directory/
D. chmod +t /directory/
The users of a Linux system are unable to use one of the application filesystems. The following outputs have been provided: bash $ cd /app $ touch file touch: cannot touch 'file': Readonly file system Output 2 /dev/sdcl on /app type ext4 (ro,relatime,seclabel,data=ordered) Output 3 /dev/sdcl /app ext4 defaults 0 0 Output 4 [302.048075] Buffer I/O error on dev sdcl, logical block 0, async page read [302.048490] EXT4-fs (sdcl): Attempt to read block from filesystem resulted in short read while trying to re- open /dev/sdcl Which of the following actions will resolve this issue? A. umount /app fsck -y /dev/sdcl mount /app B. xfs_repair /dev/sdcl mount -o rw,remount /app C. umount /app xfs_repair /dev/sdcl mount /app D. fsck -y /dev/sdcl mount -o rw,remount /app
D. fsck -y /dev/sdcl mount -o rw,remount /app
A diagnostic tool reports a "host seems down" event for a server with an IP address of 192.168.47.44. Which of the following commands should the administrator use to confirm the host down event? A. nmap 192.168.47.0/32 B. netcat 192.168.47.44 C. nmap 192.168.47.44 -Pn D. ping -c 1 192.168.47.44
D. ping -c 1 192.168.47.44
systemctl status httpd is the correct option to check if the Apache web server (httpd) is running. The systemctl status command provides detailed information about the service, including whether it is active and running. QUESTION 5 A Linux engineer wants to give read-write-execute permissions for the cloud_users directory to user Oliver. Which of the following commands should the engineer use? A. setfacl -L Oliver /cloud_users B. setfacl -x rwx /cloud_users C. setfacl -P rwx /cloud_users D. setfacl -m u:Oliver /cloud_users
D. setfacl -m u:Oliver /cloud_users
An administrator accidentally installed the httpd RPM package along with several dependencies. Which of the following options is the best way for the administrator to revert the package installation? A. dnf clean all B. rpm -e httpd C. apt-get clean D. yum history undo last
D. yum history undo last
A user (userA) has reported issues while logging in to the system. The following output has been provided: bash Could not chdir to home directory /home/userA: Permission denied -bash: /home/userA/.bash_profile: Permission denied # cat /etc/passwd | grep userA userA:x:1234:3400:userA account:/home/userA/:/bin/bash # passwd -S userA userA PS 2022-10-17 1 99999 0 (Password set. SHA512 crypt.) # groups userA admin dev usergrp # ls -lth /home/ drwx------- 7 root admin 9 Jan 17 2019 userA drwxr-xr-x 4 userC app 9 Jan 23 2020 userC Which of the following describes the issue userA is having? A. The password for userA is not set B. The group for userA is not assigned correctly C. The account password for userA has expired D. The assigned home directory is not owned by userA
D. The assigned home directory is not owned by userA
An administrator a database service outage that was reported by a monitoring system $ systemctl status mariadb Oct 20 16:40:45 comptia systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL Oct 20 16:40:45 comptia systemd[1]: mariadb.service: Failed with result 'signal'. Oct 20 16:40:50 comptia systemd[1]: Stopped MariaDB 10.3 database server. $ dmesg [ 1061.491433] oom- kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_o om, task_memcg=/system.slice/mariadb.service, task=mysqld,pid=1981,uid=27 [ 1061.491453] Out of memory: Killed process 1981 (mysqld) total-vm:330668kB, anon- rss:31316kB, file- rss:OkB, shmem-rss:OkB, UID:27 pgtables:324kB oom_score_adj:0 A. The administrator sent a kill signal to the database B. The server is missing the DMA bus C. The database cannot write anything else to the storage D. The server does not have enough physical memory
D. The server does not have enough physical memory
Users see production application has slow performance. A systems administrator logs in to the server and performs some basic checks. yaml [root@comptia]# ps -o pcpu; pidstat 1 Average: UID PID %usr %system %wait %CPU Command Average: 0 937242 32.39 0 63.21 32.39 app_prd Average: 0 937245 44.97 0.31 51.57 45.28 app_prd Average: 0 937244 23.62 0 63.55 28.62 app_prd [root@comptia]# vmstat 1 procs memory swap io system cpu r b swpd free buff cache si so bi bo in cs us sy id wa st 16 0 978912 376320 50804 10296312 0 0 0 44 5503 2962 98 2 0 0 0 [root@comptia]# free -m total used free shared buff/cache available Mem: 15533 5063 365 164 10104 9975 Swap: 7931 955 6976 Which of the following is causing the performance issue? A. The server does not have enough memory B. Too many processes are running on the server C. The server CPU is receiving too much load D. The server is swapping
D. The server is swapping
Which of the following options describes the purpose of YAML? A. YAML is a binary format used to ensure data transfer in a non-human-readable format B. YAML is used for configuration files and data serialization in IaC tools in a human- readable format C. YAML is like HTML and is used to create web page structure content for web deployment D. YAML is designed for web development and has libraries for infrastructure automation
B. YAML is used for configuration files and data serialization in IaC tools in a human- readable format
A systems administrator is creating new user accounts on several Linux machines and wants to automate the process from a Linux system used for operations. In this operations system, the list of servers is located in the /home/user/ serverslist file and the list of user accounts is located in the /home/user/userslist file. A. bash for server in $(cat /home/user/serverslist) do for user in $(cat /home/user/userslist) do sudo useradd $user done done B. bash for server in $(cat /home/user/serverslist) do ssh -i user@$server "for user in $(cat /home/user/userslist) do sudo useradd $user done; exit" done C. bash for server in $(cat /home/user/serverslist) do scp /home/user/userslist user@$server:/tmp ssh -i user@$server "for user in $(cat /tmp/userslist) do sudo useradd $user done; exit" done D. bash sshuser@$(cat/home/user/serverslist)"sudouseradd$(cat/home/user/userslist);exit"
B. bash for server in $(cat /home/user/serverslist) do ssh -i user@$server "for user in $(cat /home/user/userslist) do sudo useradd $user done; exit" done
A Linux systems administrator is trying to execute a particular shell script on a server. The administrator reviews the following outputs: shell $ ./startup.sh bash: ./startup.sh: Permission denied $ ls -l startup.sh -rw-rw-r-- 1 companyabc companyabc 18 October 15:35 startup.sh Which of the following commands should the administrator use to allow the script to run? A. chown root startup.sh B. chmod 750 startup.sh C. chmod -x startup.sh D. chmod 400 startup.sh
B. chmod 750 startup.sh
A systems administrator needs to know the mail exchange (MX) record for the foo.com domain. Which of the following commands will accomplish this task? A. telnet mx foo.com B. dig mx foo.com C. nslookup mx foo.com D. host mx foo.com
B. dig mx foo.com
An administrator is running a web server in a container named WEB, but none of the error output is showing. Which of the following should the administrator use to generate the errors on the container? A. docker-compose inspect WEB B. docker logs WEB C. docker run --name WEB --volume /dev/stdout:/var/log/nginx/error.log D. docker ps WEB -f
B. docker logs WEB
An administrator is running a web server in a container named web, but none of the error output is not showing. Which of the following should the administrator use to generate the errors on the container? A. docker-compose inspect WEB B. dockerlogs WEB C. dockerrun --nameWEB --volume/dev/stdout:/var/log/nginx/error.log D. dockerps WEB -f
B. dockerlogs WEB
A Linux administrator is configuring network traffic forwarding. Despite having proper iptables rules, the traffic forwarding is not working. Which of the following commands will allow Linux to pass network traffic between different interfaces? A. nmcli allow-forwarding eth0 B. echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf; sysctl -p C. ip route forward allow --all-interfaces; systemctl restart network D. modprobe ip_forward
B. echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf; sysctl -p
An administrator changed the default port of an SSH server to 2222 on myhost, and clients are not able to connect. The administrator runs some commands and receives the following output: vbnet Copy code $ ssh -p 2222 myhost ssh:connect to host myhost on port 2222: No route to host Which of the following commands should be run on myhost? A. firewall-cmd --zone=public --add-service=ssh B. firewall-cmd --zone=public --add-port=2222 C. iptables --zone=public --add-service=ssh D. iptables --zone=public --add-port=2222
B. firewall-cmd --zone=public --add-port=2222
A Linux administrator encounters the following error in the Apache log files: css SQLSTATE[HY000] [2002] Permission denied Which of the following commands should the administrator run to safely fix this issue? A. chcon -c httpd_sys_content_t /home/apache B. setsebool -F httpd_can_network_connect_db on C. setenforce 0 D. touch /.autorelabel
B. setsebool -F httpd_can_network_connect_db on
A Linux administrator needs to list the packages that are currently installed on a server. Which of the following commands should the administrator use? A. snap install list B. snap list C. snap show D. snap packages
B. snap list
The journald entries have filled a Linux machine's /var volume. Which of the following is the best command for a systems administrator to use to free up the disk space occupied by these entries? A. journalctl --rotate journalctl --vacuum-time=ls B. systemctl stop systemd-journald systemctl start systemd-journald C. rm -rf /var/log/journal systemctl restart systemd-journald D. pkill -HUP systemd-journald systemctl restart systemd-journald
B. systemctl stop systemd-journald systemctl start systemd-journald
A Linux administrator is implementing a stateful firewall on the Linux server. Which of the following iptables options will be required to build the stateful rules? (Select two). A. --name established B. -m recent C. -m conntrack D. --state E. --remove F. -j DROP
C. -m conntrack D. --state
A Linux systems administrator is updating code. After completing the update, the administrator wants to publish the updated code without including the configuration files. Which of the following should the administrator use to accomplish this task? A. git clone B. git - C. .gitignore D. git fetch
C. .gitignore
A systems administrator wants to list all local account names and their respective UIDs. Which of the following commands will provide output containing this information? A. cut -c: -f3,1 /etc/passwd B. cut -d: -s2,3 /etc/passwd C. cut -d: -f1,3 /etc/passwd D. cut -n: -f1,2 /etc/passwd
C. cut -d: -f1,3 /etc/passwd
A Linux administrator needs to determine if prerequisites are met. One of the application requirements is to install Perl on a system. Which of the following commands would accomplish this task? A. rpm -Ufperl B. rpm -ivperl C. rpm -qaperl D. rpm -ehperl
C. rpm -qaperl
After trying to install an RPM package unsuccessfully, a systems administrator verifies the integrity of the package's database. The administrator discovers that the database is corrupted and needs to be recreated. Which of the following commands will help accomplish this task? A. rpmdb -D rebuild B. rpmdb --initdb C. rpmdb --rebuilddb D. rpmdb --exportdb
C. rpmdb --rebuilddb