CompTIA Linux+

Ace your homework & exams now with Quizwiz!

A Linux administrator is setting up a testing environment and needs to connect to a separate testing server using the production server name. The administrator needs to override the hostname that the DNS is returning in order to use the test environment. Which of the following commands should be run on each of the testing systems to BEST meet this goal?

# echo "192.168.1.100 production.company.com" >> /etc/hosts

An administrator needs to mount the shared NFS file system testhost:/testvolume to mount point /mnt/testvol and make the mount persistent after reboot. Which of the following BEST demonstrates the commands necessary to accomplish this task?

# mhdir -p /mnt/testvol # echo "testhost:/testvolume /mnt/testvol nfs deaults 0 0" >> etc/fstab # mount -a

A Linux administrator needs the "tech" account to have the option to run elevated commands as root. Which of the following commands would BEST meet this goal?

# usermod -aG wheel tech

A Linux administrator wants to obtain a list of files and subdirectories in the /etc directory that contain the word "services". Once the files and subdirectories are discovered, they should be listed alphabetically in the /var/tmp/foundservices file. Which of the following shell scripts will accomplish this task?

#/bin/bash find /etc -name services | sort > /var/tmp/foundservices

A networked has been crashing intermittently. A Linux administrator would like to write a shell script that will attempt to ping the server and email an alert if the server fails to respond. The script will later be scheduled via cron job. Which of the following scripts would BEST accomplish this task?

B. SERVER="192.168.1.50" ping -c 2 $SERVER > /dev/null if [ $? -ge 1 ]; then echo "Serv er is down" | mail -s "Server down" admin@mail_address.com fi

A Linux server needs to be accessed, but the root password is not available. Which of the following would BEST allow an administrator to regain access and set a new known password at the same time?

Boot into single-user mode and reset the password via the passwd command.

A Linux administrator is using a public cloud provider to host servers for a company's website. Using the provider's tools, the administrator wrote a JSON file to define how to deploy the servers. Which of the following techniques did the administrator use?

Build automation

Given that a company's policy states that users cannot install third-party tools on Window servers, which of the following protocols will allow a Linux GUI to connect to a Windows server?

RDP

A Linux systems administrator wants the ability to access systems remotely over SSH using RSA authentication. To which of the following files should the RSA token be added to allow this access?

authorized_keys

A systems administrator needs to retrieve specific fields from a CSV file. Which of the following tools would accomplish this task?

awk

A systems administrator is configuring options on a newly installed Linux VM that will be deployed to the Pacific time zone. Which of the following sets of commands should the administrator execute to accurately configure the correct time settings?

cd /etc ln -s /usr/share/zoneinfo/US/Pacific localtime

Ann, a junior systems administrator, is required to add a line to the /etc/yum.conf file. However, she receives the following error message when she tries to add the line: root!comptia:~# echo "line" > /etc/yum.conf -su: /etc/yum.conf: Operation not permitted Ann performs some diagnostics to attempt to find the root cause: root!comptia:~# ls -l /etc/yum.conf -rw-r--r-- 1 root root 970 Jan 30 2018 /etc/yum.conf root!comptia:~# lsattr /etc/yum.conf ----i--------e-- /etc/yum.conf Which of the following commands should Ann execute to write content to /etc/yum?

chattr -i /etc/yum.conf

A Linux administrator needs to set permissions on an application with the following parameters: The owner of the application should be able to read, write, and execute the application. Members of the group should be able to read and execute the application. Everyone else should not have access to the application. Which of the following commands would BEST accomplish these tasks?

chmod 750 <application name>

A Linux administrator needs every new file created on a directory to maintain the group permissions of the same directory. Which of the following commands would satisfy this requirement?

chmod g+s <directory>

A Linux administrator needs to remotely update the contents of the www.comptia.org/contacts URL. Which of the following commands would allow the administrator to download the current contents of the URL before updating?

curl www.comptia.org/contacts

A systems administrator configured a new kernel module, but it stopped working after reboot. Which of the following will allow the systems administrator to check for module problems during server startup?

dmesg

A Linux administrator must identify a user with high disk usage. The administrator runs the # du -s /home/* command and gets the following output: 43 /home/User1 2701 /home/User2 133089 /home/User3 3611 /home/User4 Based on the output, User3 has the largest amount of disk space used. To clean up the file space, the administrator needs to find out more information about the specific files that are using the most disk space. Which of the following commands will accomplish this task?

du -a /home/User3/*

A Linux administrator has configured a Linux system to be used as a router. The administrator confirms that two network adapters are properly installed and functioning correctly. In addition, the output of the iptables -L command appears to contain a complete firewall configuration. Which of the following commands does the administrator need to issue for the router to be fully functional?

echo "1" > /proc/sys/net/ipv4/ip_forward

A Linux administrator is using a Linux system as a router. During the tests, the administrator discovers that IP packets are not being sent between the configured interfaces. Which of the following commands enables this feature for IPv4 networks?

echo "1" > /proc/sys/net/ipv4/ip_forward

A new corporate policy states that Bluetooth should be disabled on all company laptops. Which of the following commands would disable the use of Bluetooth?

echo "blacklist bluetooth" > /etc/modprobe.d/blacklist-bluetooth

A junior systems administrator is configuring localization option environment variables. The administrator is given a checklist of tasks with the following requirements: View current settings of the LC_ALL environment variable only. Modify the LANG environment variable to US English Unicode. Given this scenario, which of the following should be performed to meet these requirements?

echo $LC_ALL export LANG = en_US.UTF-8

A server is almost out of free memory and is becoming unresponsive. Which of the following sets of commands will BEST mitigate the issue?

fdisk, mkswap, swapon -a

A Linux administrator wants to fetch a Git repository from a remote Git server. Which of the following is the BEST command to perform this task?

git clone

Which of the following is modified to reconfigure the boot environment?

grub.cfg

A Linux administrator is testing a new web application on a local laptop and consistently shows the following 403 errors in the laptop's logs: type=AVC msg=audit(126552035:37232):avc:denied {read} for pid=24941 com=nginx nme=" /home/user1" /dev/sda1 ino=2 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content:s0 The web server starts properly, but an error is generated in the audit log. Which of the following settings should be enabled to prevent this audit message?

httpd_can_network_connect = 1

A Linux administrator opens a ticket to have an external hard drive mounted. As a security policy, external storage kernel modules are disabled. Which of the following is the BEST command for adding the proper kernel module to enable external storage modules?

insmod /lib/modules/3.6.12-100-generic/kernel/drivers/usb/storage/usb-storage.ko

An administrator is attempting to block SSH connections to 192.168.10.24 using the Linux firewall. After implementing a rule, a connection refused error is displayed when attempting to SSH to 192.168.10.24. Which of the following rules was MOST likely implemented?

iptables -A -p tcp -d 192.168.10.24 --dport 22 -j REJECT

A Linux administrator built a GitLab server. Later that day, a software engineer tried to access the server to upload the repository during the final step of installation. The software engineer could not access the website. Which of the following firewall rules would allow access to this site?

iptables -A INPUT -p tcp -m multiport --dports 80,443 -m conntrack -cstate RELATED, ESTABLISHED -j ACCEPT

A new HTTPS web service is being deployed on a server. Which of the following commands should the Linux administrator use to ensure traffic is able to flow through the system firewall to the new service?

iptables -I INPUT --dport 443 -j ACCEPT

An administrator has modified the configuration file for a service. The service is still running but is not using the new configured values. Which of the following will BEST remediate this issue?

kill -HUP

A Linux system is running normally when the systems administrator receives an alert that one application spawned many processes. The application is consuming a lot of memory, and it will soon cause the machine to become unresponsive. Which of the following commands will stop each application process?

killall application

A junior Linux administrator is installing patches using YUM. The administrator issues the following command: yum list installed The output of the command is as follows: loaded plugins: fastmirror, langpacks Existing lock /var/run/yum.pid: another copy is running as pid 5180 Another app is currently holding the yum lock; waiting for it to exit... The other application is yum Memory: 26 M RSS [R415 MB VSZ] Started: Fri Jun 15 08:05:15 2018 - 2:18:48 ago state: traced/stopped pid: 5180 Given this scenario and the output, which of the following should the administrator do to address this issue?

killall yum

Which of the following commands would show the default printer on a Linux system?

lpq or ipstat

An operator finds a user is having issues with opening certain files. Which of the following commands would allow the security administrator to list and check the SELinux context?

ls -Z

A systems administrator needs to append output of ls -lha /opt command to the contents of a test.txt file. Which of the following commands will accomplish this?

ls -lha /opt >> test.txt

Which of the following will provide a list of all flash, external, internal, and SSD drives?

lsblk

An administrator receives a warning about a filesystem filling up, and then identifies a large file located at /tmp/largelogfile. The administrator deletes the file, but no space is recovered on the filesystem. Which of the following commands would BEST assists the administrator in identifying the problem?

lsof | grep largelogfile

A Linux administrator needs to take stock of USB devices attached to the system. Which of the following commands would be BEST to complete this task?

lsusb

An administrator is tasked with increasing the size of the volume /dev/vg/lv to 20GB. Which of the following BEST illustrates the steps the administrator should take?

lvextend -L20G /dev/vg/lv; resize2fs /dev/vg/lv

A user attempts to use the mount -a command but gets the following error: mount: mount point /mnt/test does not exist Which of the following commands best describes the action the Linux administrator should take NEXT?

mkdir -p /mnt/test

A junior administrator of a physical server receives log messages indicating the out-of-memory killer has been active. All memory slots are in use on the motherboard, but additional disk space is available. Space has been allocated for a swap file. Which of the following should the administrator use to reduce the output of memory messages?

mkswap /swapfile; swapon -a

A systems administrator needs to install a new piece of hardware that requires a new driver. The driver should be manually installed. Which of the following describes the order of commands required to obtain module information, install the module, and check the log for any errors during module installation?

modinfo, insmod, dmesg or lsmod, insmod, dmesg

A junior administrator needs to unload an older video kernel module. Which of the following commands would BEST accomplish this task?

modprobe

A user has connected a Bluetooth mouse to a computer, but it is not working properly. Which of the following commands should the systems administrator use to fix the issue?

modprobe -r bluetooth

A systems administrator is enabling quotas on the /home directory of a Linux server. The administrator makes the appropriate edits to the /etc/fstab file and attempts to issue the commands to enable quotas on the desired directory. However, the administrator receives an error message stating the filesystem does not support quotas. Which of the following commands should the administrator perform to proceed?

mount -o remount /home

A systems administrator observes high latency values when reaching a remote web server. Which of the following commands will help determine and isolate issues on the network side?

mtr

A systems administrator has received reports of intermittent network connectivity to a particular website. Which of the following is the BEST command to use to characterize the location and type of failure over the course of several minutes?

mtr www.comptia.org

A Linux server has multiple IPs. A Linux administrator needs to verify if the HTTP server port is bound to the correct IP. Which of the following commands would BEST accomplish this task?

netstat

An administrator needs to change the IP address on a server remotely. After updating the configuration files, a network restart is needed. However, the administrator fears that when the network connection drops, the network restart script will be killed before the new IP address has been set. Which of the following commands would prevent the script from being killed?

nohup service network restart

An administrator is analyzing a Linux server which was recently hacked. Which of the following will the administrator use to find all unsuccessful login attempts?

pam_tally2

A junior Linux administrator is trying to verify connectivity to the remote host host1 and display round-trip statistics for ten ICMP requests. Which of the following commands should the administrator execute?

ping -c 10 host1

A Linux administrator is testing connectivity to a remote host on a shared terminal. Theadministrator wants to allow other users to access the terminal while the command is executing. Which of the following commands should the administrator use?

ping remotehost &

A Linux storage administrator wants to create a logical volume group. Which of the following commands is required to start the process?

pvcreate

An administrator notices that a long-running script, /home/user/script.sh, is taking up a large number of system resources. The administrator does not know the script's function. Which of the following commands should the administrator use to minimize the script's impact on system resources?

renice

Given the output below: drwxr-xr-x. 4096 user1 user1 Documents drwxr-xr-x. 4096 user1 user1 Music lrwxrwxrw. 1 root root MyPhoto.jpg ->/pictures/photo.jpg drwxr-xr-x. 4096 user1 user1 Pictures -rw-r--r--. 256 user1 user1 text.text -rw-r--r--. 35 user1 user1 tmp.tmp Which of the following commands can be used to remove MyPhoto.jpg from the current directory?

rm -f MyPhoto.jpg

An administrator needs to create a shared directory in which all users are able to read, write, and execute its content but none of the regular users are able to delete any content. Which of the following permissions should be applied to this shared directory?

rwxrwxrwt

A Linux systems administrator needs to copy the contents of a directory named "working" on the local working system to a folder /var/www/html on a server named "corporate-web". Which of the following commands will allow the administrator to copy all the contents to the web server?

scp -r working/* webuser@corporate-web:/var/www/html

Ann, a junior Linux administrator, needs to copy software from her local machine to assist in developing a software application on a remote machine with the IP address 192.168.3.22. The file needs to be placed on the /tmp directory. After downloading the RPM to the local machine, which of the following commands would be BEST to use to copy the software?

scp ~/software.rpm [email protected]:/tmp

Two specific users need access to a directory owned by root where backups are located. Which of the following commands would BEST ensure the specified users can access the backup files?

setfacl

A systems administrator wants to know the current status of a series of dd jobs that were started in the background three hours ago. Which of the following commands will achieve this task?

sudo killall -USR1 dd

A Linux administrator needs to back up the folder /usr/domain, and the output must be a gzip compressed tar. Which of the following commands should be used?

tar -czvf domain.tar.gz /usr/domain

A systems administrator must clean up all application files in the directory /var/log/app. However, the company's security policy requires the files to be kept on the backup server for one year. The Linux server has only the tar and bzip2 packages installed. Which of the following commands will package and compress the files?

tar -jcvf applicationfiles.tar.bz2 /var/log/app/*

A company wants to ensure that all newly created files can be modified only by their owners and that all new directory content can be changed only by the creator of the directory. Which of the following commands will help achieve this task?

umask 0022

Joe, a user, is unable to log in to the server and contracts the systems administrator to look into the issue. The administrator examines the /etc/passwd file and discovers the following entry: joe:x:505:505::/home/joe:/bin/false Which of the following commands should the administrator execute to resolve the problem?

usermod -s /bin/bash joe

A junior systems administrator is upgrading a package that was installed on a Red Hat-based system. The administrator is tasked with the following: Update and install the new package. Verify the new package version is installed. Which of the following should be done to BEST accomplish these task? (Choose two.)

yum install <package name> rpm -qa

Which of the following statements BEST represents what the term "agentless" means regarding orchestration?

Installation of a tool is not required on the remote system to perform orchestration tasks

A junior Linux administrator is optimizing a system in which an application needs to take priority 0 when running the process. The administrator runs the ps command and receives the following output: PID PPID TTY TIME CMD 8481 2 pts/17 16:140:00 app 9854 0 pts/17 16:40:00 ps Given this scenario, which of the following steps will address this issue?

Issue the command renice -n 0 -p 8481

An administrator reviews the following configuration file provided by a DevOps engineer: Tasks: - name:Install php-fpm from repo yum: name: php-fpm state: present - name:Install mysql from repo yum: name: mysql-server state: present Which of the following would the application parsing this file MOST likely have to support?

JSON

Which of the following are Linux desktop managers? (Choose two.)

KDE and GNOME

Which of the following is the template for the grub.cfg file?

/etc/default/grub

Which of the following configuration files should be modified to disable Ctrl+Alt+Del in Linux?

/etc/inittab

An administrator needs to see a list of the system user's encrypted passwords. Which of the following Linux files does the administrator need to read?

/etc/shadow

In order to comply with new security policies, an administrator needs to prevent the SSH server from using insecure algorithms. Which of the following files should be edited to accomplish this?

/etc/ssh/sshd_config

A systems administrator has deployed a Linux server based on an Anaconda process with all packages and custom configurations necessary to install a web server role. Which of the following could be used to install more Linux servers with the same characteristics?

/root/anaconda-ks.cfg

A systems administrator has set up third-party log aggregation agents across several cloud instances. The systems administrator wants to create a dashboard of failed SSH attempts and the usernames used. Which of the following files should be watched by the agents?

/var/log/audit/audit.log

After starting a long-running script, a systems administrator needs to verify the frequency of what is filling up the /var partition and kill it because it is consuming too much space. Which of the following is the correct sequence given only a terminal is available?

1. CTRL-Z 2. bg 3. watch df /var 4. CTRL-C 5. fg 6. CTRL-C

The lead Linux admin has added a disk, /dev/sdd, to a VM that is running out of disk space. Place the following steps in the correct order from first (1) to last (4) to add the disk to the existing LVM.

1. pvcreate /dev/sdd 2. vgextend vgdata /dev/sdd 3. lvexstend -L +10GB ?dev/mapper/vgdata-data 4. resize2fs /dev/mapper/vgdata-data

Which of the following configuration management tools is considered agentless?

Ansible

Which of the following server roles would assign a host IP address?

DHCP

A systems administrator wants to deploy several applications to the same server quickly. Each application should be abstracted from the host with its own dependencies and libraries and utilize a minimal footprint. Which of the following would be BEST in this scenario?

Containers

Which of the following BEST describes containers running on a Linux system?

Containers use the cgroups and namespaces functionalities to isolate processes and assign hardware resources to each of those isolated processes.

Which of the following is the BEST reason for not storing database files in the /var directory?

If log files fill up /var, it might corrupt the database.

A systems administration team has decided to treat their systems as immutable instances. They keep the desired state of each of their systems in version control and apply automation whenever they provision a new instance. If there is an issue with one of their servers, instead of troubleshooting the issue they terminate the instance and rebuild it using automation. Which of the following is this an example of?

Infrastructure as code

A systems administrator has finished building a new feature for the monitoring software in a separate Git branch. Which of the following is the BEST method for adding the new feature to the software's master branch?

Merge the changes from the feature branch to the master branch.

A junior Linux administrator is updating local name resolution to support IPv6. The administrator issues the command cat /etc/hosts and receives the following output: 127.0.0.1 localhost Which of the following actions should the administrator perform to accomplish this task?

Modify the /etc/hosts file, and add the ::1 localhost entry to the file.

A junior administrator is migrating a virtual machine from a Type 1 hypervisor to a Type 2 hypervisor. To ensure portability, which of the following formats should the administrator export from the Type 1 hypervisor to ensure compatibility?

OVA

A junior Linux administrator is installing a new application with CPU architecture requirements that have the following specifications: x64 bit 3.0GHz speed Minimum quad core The administrator wants to leverage existing equipment but is unsure whether the requirements of these systems are adequate. The administrator issues the following command cat /proc/cpuinfo. The output of the command is as follows: processor: 0 vendor_id: genuineIntel cpu_family: x64 model: 58 modle name: Intel (R) Core(TM) i7-3687U @2.10 GHz stepping: 9 microcode: 0x1c cpu MHz: 2593.8% cache size: 4096KB siblings: 1 cire id: 0 cpu cores: 4 Which of the following is the recommended course of action the administrator should take based on this output?

Procure new equipment that matches the recommended specifications

A Linux administrator implemented a new HTTP server using the default configuration. None of the users on the network can access the server. If there is no problem on the network or with the users' workstations, which of the following steps will BEST analyze and resolve the issue?

Run netstat to ensure the port is correctly bound, and configure the firewall to allow access on ports 80 and 443

While creating a file on a volume, the Linux administrator receives the following message: No space left on device. Running the df -m command, the administrator notes there is still 50% of usage left. Which of the following is the NEXT step the administrator should take to analyze the issue without losing data?

Run the df -i command and notice the inode exhaustion

A Linux administrator needs to switch from text mode to GUI. Which of the following runlevels will start the GUI by default?

Runlevel 5

A technical support engineer receives a ticket from a user who is trying to create a 1KB file in the /tmp directory and is getting the following error: No space left on device. The support engineer checks the /tmp directory, and it has 20GB of free space. Which of the following BEST describes a possible cause for this error?

The /tmp directory has been set with an immutable attribute.

Which of the following is the purpose of the monitoring server role?

To collect status and performance information about the servers in an environment

A Linux systems administrator needs to provision multiple web servers into separate regional datacenters. The systems architect has instructed the administrator to define the server infrastructure using a specific tool that consumes a text-based file. Which of the following is the BEST reason to do this?

To define the infrastructure so it can be provisioned consistently with minimal manual tasks

Which of the following is the purpose of the vmlinux file on a Linux system?

To provide the executable kernel for the system

Which of the following can be used to boot a DVD from a remote device to initialize a Linux system setup on bare metal hardware as if it is a local DVD?

UEFI

A junior Linux administrator is setting up system-wide configuration settings. The goal is to ensure the PATH environment variable includes the following locations for all users who log into a Linux system: /user/local/bin /usr/local/sbin The administrator issues the following commands at the terminal: echo $PATH cat /etc/profile Respectively, the output of these commands is as follows: /usr/bin:/usr/sbin:/sbin:/bin Given this output, which of the following would be the BEST action for the administrator to perform to address this issue?

Update the /etc/profile file using a text editor, navigate to the PATH element, add the missing locations and run the . /etc/profile command to update the changes.

Which of the following is a difference between YAML and JSON?

Users can comment in YAML but not in JSON

Which of the following would be the BEST solution for a systems administrator to access the graphical user environment of a Linux machine remotely

VNC

Which of the following BEST describes the purpose of the X11 system?

X11 provides graphical display capabilities


Related study sets

Module 14.1: Latin American Peoples Win Independence

View Set

Funds Basics MedSurg Infectious Disease and Respiratory

View Set

Ch 19: Postoperative Nursing Management

View Set

Module 3.3 Chapter 12. Achievement.

View Set