Special Summer Sale 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: save70

Online XK0-005 Questions Video

Page: 20 / 30
Total 401 questions

CompTIA Linux+ Exam Questions and Answers

Question 77

A file called testfile has both uppercase and lowercase letters:

$ cat testfile

ABCDEfgH

IJKLmnoPQ

abcdefgH

ijklLMNopq

A Linux administrator is tasked with converting testfile into all uppercase and writing it to a new file with the name uppercase. Which of the following commands will achieve

this task?

Options:

A.

tr '(A-Z}' '{a-z}' < testfile > uppercase

B.

echo testfile | tr "[Z-A]" "[z-a]" < testfile > uppercase

C.

cat testfile | tr '{z-a)' '{Z-A}' < testfile > uppercase

D.

tr '[a-z]' '[A-Z]' < testfile > uppercase

Question 78

A network administrator issues the dig command and receives an NXDOMAIN response. Which of the following files should the administrator check first?

Options:

A.

/etc/resolv.conf

B.

/etc/hosts

C.

/etc/sysconfig/network-scripts

D.

/etc/nsswitch.conf

Question 79

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. Which of the following scripts will help accomplish this task?

Options:

A.

bashfor server in $(cat /home/user/serverslist) do for user in $(cat /home/user/userslist) do sudo useradd $user done done

B.

bashfor 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.

bashfor 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.

bashssh user@$(cat /home/user/serverslist) "sudo useradd $(cat /home/user/userslist); exit"

Question 80

A Linux administrator provisioned a new web server with custom administrative permissions for certain users. The administrator receives a report that user1 is unable to restart the Apache web service on this server. The administrator reviews the following output:

[ root@server ] # id user1

UID=1011 (user1) gid=1011 (USER1) groups=1011 (user1), 101 (www-data), 1120 (webadmin)

[ root@server ] # cat /etc/sudoers.d/custom.conf

user1 ALL=/usr/sbin/systemctl start httpd, /usr/sbin/systemctl stop httpd

webadmin ALL=NOPASSWD: /etc/init.d.httpd restart, /sbin/service httpd restart, /usr/sbin/apache2ctl restart

#%wheel ALL=(ALL) NOPASSWD: ALL

Which of the following would most likely resolve the issue while maintaining a least privilege security model?

Options:

A.

User1 should be added to the wheel group to manage the service.

B.

User1 should have "NOPASSWD:" after the "ALL=" in the custom. conf.

C.

The wheel line in the custom. conf file should be uncommented.

D.

Webadmin should be listed as a group in the custom. conf file.

Page: 20 / 30
Total 401 questions