CompTIA's Linux+ Exam
7 questions. Answers and detailed explanations can be found at the end of the quiz.
courtesy of Transcender LLC
Questions
1. Which of the following commands, when issued, protects a file named classic from being deleted by root?
a. chattr +c classic
b. chattr +i classic
c. chmod 000 classic
d. chmod a-rwx classic
2. You are installing the Linux operating system on a computer. You want the Linux installation program to search for bad blocks. Which step in the Linux installation process for most Linux distributions enables the installation program to search for bad blocks?
a. the hard disk formatting step
b. the hard disk partitioning step
c. the installation type step
d. the Linux Loader (LILO) configuration step
3. Which of the following lines of text, when added to the /etc/crontab file, will run the cleanup script on the first day of every month at 2:05 A.M.?
a. 2 5 * 1 * cleanup
b. 5 2 1 1 * cleanup
c. 5 2 1 * * cleanup
d. 2 5 * * 1 cleanup
4. Which of the following best describes what will occur when the su -c 'kill 392' root command is issued and a valid password is entered?
a. A user will kill the process named 392, which was started by root.
b. A user is given root-level permissions, and the process with PID number 392 will be terminated.
c. A user is given root-level permissions, and the processes started in March of 1992 will be terminated.
d. The root user will kill all of the processes that were started by root.
5. Which of the following can you use if you want to configure a Linux computer only as a firewall?
a. Apache
b. BIND
c. iptables
d. Squid
6. Your Linux computer has a serial mouse on COM1. You want to connect an external modem to the computer. Connecting the modem to which of the following ports can cause the modem and mouse to malfunction?
a. COM2
b. COM3
c. COM4
d. USB
7. Which of the following statements best describes what will happen when the rpm -qa command is issued?
a. The name of each installed package will be displayed.
b. All of the packages installed on the computer will be verified.
c. Detailed information about an installed package will be displayed.
d. The name of each file contained within a package will be displayed.
Answers:
1) Choice b is correct. When the chattr +i classic command is issued, the file named classic is protected from deletion. This command sets the immutable attribute for the classic file. Neither regular users nor the root user can delete, modify or rename a file with the immutable attribute set. Additionally, no links may be created to a file that has the immutable attribute set. Only the root user can set or remove the immutable attribute. To remove the immutable attribute from classic, the command chattr -i classic should be issued. When the immutable attribute is cleared, the file can be deleted.
When the command chattr +c classic is issued, classic will be compressed on the hard disk. However, classic can still be deleted. When the chmod 000 classic command is issued, the read, write and execute attributes for classic are removed for all users. Similarly, the chmod a-rwx classic command also removes the read, write and execute attributes for classic for all users. However, the owner of the file and the root user can still delete classic. Reference: LSGe, Bookmarks, "Chapter 4: Users and Security," "File Permissions," "File Access Permissions." LSGe, Bookmarks, "Chapter 4: Users and Security," "File Permissions," "Changing File Ownership and Permissions." Linux man pages, man chattr.
2) Choice a is correct. During the installation process for most Linux distributions, you can choose to configure the installation program to search for bad blocks during the hard disk formatting step. If you choose this option, then bad blocks will be marked when a hard disk is formatted with a filesystem.
Bad blocks are defective areas on a hard disk that cannot be used to store data. If your Linux computer reports an error message indicating that bad inode entries or bad blocks have occurred on a hard disk, then you might be required to rebuild the filesystem by running the fsck utility. If the fsck utility does not repair the bad inode entries, you should reformat the hard drive and search for bad blocks. However, bad blocks usually indicate that a hard drive is failing. Hard disks with bad blocks should be replaced as soon as possible.
You can partition a hard disk on most Linux computers by using the Disk Druid utility. Partitioning a hard disk divides it into one or more sections. You should partition a hard disk prior to formatting. Each partition on a hard disk can be formatted with a different filesystem. During the installation type step of the Linux setup process, you can select which type of Linux installation to use. For example, most Linux distributions enable you to install a workstation, a server or a custom Linux computer. LILO is a boot loader provided with most Linux distributions. During the LILO configuration step, you can select which operating system is loaded by default and how the other operating systems on a multiboot Linux computer can be loaded. Usually, LILO is configured to load a Linux operating system by default. Reference: LB, Chapter 3, Configuring a Boot Disk, pp. 22-30.
3) Choice c is correct. The line 5 2 1 * * cleanup, when added to the /etc/crontab file, will run the cleanup script on the first day of every month at 2:05 A.M. The /etc/crontab file is the system crontab file, which is used to schedule system tasks to be run at a certain time.
The lines in a crontab file follow the syntax minute hour date month day command. The minute variable is a numeric value from 0 through 59 that corresponds to the minute that the command should be run. The hour variable is a numeric value from 0 through 23 that corresponds to the hour that the command should be run. The date variable is a numeric value from 1 through 31 that corresponds to the day of the month that the command should be run. The month variable is a numeric value from 1 through 12 that corresponds to the month that the command should be run. The first three characters of the month, such as Jan for January, can also be used for the month variable. The day variable is a numeric value from 0 through 7 that corresponds to the day that the command should be run; the numbers 0 and 7 correspond to Sunday, 1 corresponds to Monday, and so on. The first three characters of the day, such as Wed for Wednesday, can also be used for the day variable. An asterisk (*) refers to all possible values for a variable. Therefore, the line 5 2 1 * * cleanup will run the cleanup script on the first day of every month at 2:05 A.M.
If the line 2 5 * 1 * cleanup is added to the /etc/crontab file, then the cleanup script will be run every day in January at 5:02 A.M. If the line 5 2 1 1 * cleanup is added to the /etc/crontab file, then the cleanup script will be run only on the first day of January at 2:05 A.M. If the line 2 5 * * 1 cleanup is added to the /etc/crontab file, then the cleanup script will be run every Monday at 5:02 A.M. Reference: LSGe, Bookmarks, "Chapter 7: Managing Partitions and Processes," "Creating System Cron Jobs."
4) Choice b is correct. The su -c 'kill 392' root command will temporarily provide a user with root-level permissions, and the process with process ID (PID) number 392 will be terminated. After the command that is enclosed in apostrophes (') is performed, the user will return to normal user-level permissions.
The su command is used to switch the user from the current user account to a different user account. The su -c command issues a single command with the permissions of the specified user. When the su command is issued without a user name, root permissions are given if the root password is known. When the su command is issued with a specified user name, the current user will be switched to the specified user, after the specified user's password is entered; however, if the current user is root, then no password is required to change to another user's account.
The kill command is used to kill a process with the specified PID. Ordinary users can only kill processes that they have started; the root user can kill any process. You can determine the PID of a running process by issuing the ps command. The killall command is used to kill all instances of a process by specifying the process name. Processes cannot be killed on a Linux computer by providing a user name or by providing a process start time. Reference: LSGe, Bookmarks, "Chapter 7: Managing Partitions and Processes," "Managing Processes," Killing Processes." Linux man pages, man su. Linux man pages, man ps.
5) Choice c is correct. You can use iptables if you want to configure a Linux computer only as a firewall. The iptables tool allows you to create a list of rules to filter network access to a Linux computer. The rules can be designed to filter access based on IP addresses or network ports. The iptables tool can be used with kernel 2.4.x and later versions; kernel 2.2.x and earlier versions use the ipchains tool instead of iptables.
You can use Apache if you want to configure a Linux computer as a Web server. You can use Berkeley Internet Name Domain (BIND) if you want to configure a Linux computer as a Domain Name System (DNS) server. If you want to configure a Linux computer as a proxy server, then you can use Squid. Reference: LSGe, Bookmarks, "Chapter 1: Planning the Implementation," "Determining Software Needs," "Common Server Programs."
6) Choice b is correct. Connecting the modem to the COM3 serial port can cause the modem and mouse to malfunction. The COM1 and COM3 serial ports share interrupt request (IRQ) 4. The COM2 and COM4 serial ports share IRQ 3. When two devices simultaneously attempt to use the same IRQ, one or both devices will stop functioning. Therefore, the external modem should be connected to COM2 or COM4. If the modem is Universal Serial Bus (USB)-compatible, then it can be connected to an available USB port. Reference: LTCR, Chapter 6, Modem Setup, pp. 123-124. TMRP, Chapter 35, Addresses and Interrupts, pp. 1283-1285.
7) Choice a is correct. When the rpm -qa command is issued, the name of each installed package will be displayed. The -q option is used to query a package; the -a option is used in conjunction with -q to query all packages.
To verify all of the packages installed on a computer, the rpm -Va command should be issued. To display detailed information about an installed package, the rpm -qi package command should be issued, where package is the name of the package of interest. To display the name of each file contained within a package, the rpm -ql package should be issued, where package is the name of the package that contains the files to be listed. Reference: LSGe, Bookmarks, "Chapter 3: Software Management," "Installing and Removing Packages," "RPM Packages."
These questions and answers are provided by Transcender LLC. Order the full version of this exam simulation online at www.transcender.com, phone 615-726-8779, 8 a.m. - 6 p.m., (CST), M - F, fax 615-726-8884, or mail to or mail to Transcender LLC, 565 Marriott Drive, Suite 300, Nashville, TN 37214.
More Pop Quiz:
|