diff --git a/certificates/essentials/test.md b/certificates/essentials/test.md new file mode 100644 index 0000000..83ae08f --- /dev/null +++ b/certificates/essentials/test.md @@ -0,0 +1,618 @@ +# Chapter 1 + +##Suggested Exercises + +* Make a list of the programs you run as an ordinary user, including everything from a calculator applet to a major office suite. Look for equivalents at http://www.linuxrsp.ru/win-lin-soft/table-eng or http://www.linuxalt.com. Is there anything you can't find? If so, try a Web search to find an equivalent. +* Read more about two or three Linux distributions by perusing their Web pages. Which distribution would you select for running a major Web server? Which distribution sounds most appealing for use by office workers who do word processing and email? + +## Review Questions + +1. Which of the following is **not** a function of the Linux kernel? + A. Allocating memory for use by programs + B. Allocating CPU time for use by programs + C. Creating menus in GUI programs + D. Controlling access to the hard disk + E. Enabling programs to use a network +2. Which of the following is an example of an embedded Linux OS? + A. Android + B. SUSE + C. CentOS + D. Debian + E. Fedora +3. Which of the following is a notable difference between Linux and Mac OS X? + A. Linux can run common GNU programs, whereas OS X cannot. + B. Linux's GUI is based on the X Window System, whereas OS X's is not. + C. Linux cannot run on Apple Macintosh hardware, whereas OS X can run only on Apple hardware. + D. Linux relies heavily on BSD software, whereas OS X uses no BSD software. + E. Linux supports text-mode commands, but OS X is a GUI-only OS. +4. True or false: The Linux kernel is derived from the BSD kernel. +5. True or false: If you log into a Linux system in graphical mode, you cannot use text-mode commands in that session. +6. True or false: CentOS is a Linux distribution with a long release cycle. +7. A Linux text-mode login prompt reads `____________` (one word). +8. A common security problem with Windows that's essentially nonexistent on Linux is `____________`. +9. Pre-release software that's likely to contain bugs is known as `____________` and `____________` + +# Chapter 2 + +## Suggested Exercises + +* Read the Features Web page on FreeBSD, http://www.freebsd.org/features.html, a competitor to Linux. How would you say it differs from Linux? +* Research the features of two or three open source programs that interest you, such as Apache, LibreOffice, and Mozilla Firefox. Do the feature lists seem complete? Are there features missing that are present in commercial counterparts? + +## Review Questions + +1. What type of multitasking does Linux use? + A. Preemptive + B. Multi-user + C. Co-operative + D. Single-tasking + E. Single-user +2. Which of the following is a characteristic of all open source software? + A. The software cannot be sold for a profit; it must be distributed free of charge. + B. It must be distributed with both source code and binaries. + C. Users are permitted to redistribute altered versions of the original software. + D. The software was originally written at a college or university. + E. The software must be written in an interpreted language that requires no compilation. +3. Which of the following programs is **most** likely to be installed and regularly used on a desktop computer that runs Linux? + A. Apache + B. Postfix + C. Android + D. Evolution + E. BIND +4. True or false: VMS was a common OS on x86 PCs at the time Linux was created. +5. True or false: Some DVRs run Linux. +6. True or false: A Linux computer being used as a server generally does not require X. +7. Linux uses a `____________` kernel design, as contrasted with a microkernel design. +8. A type of software that's distributed for free but that requires payment on the "honor system" if a person uses it is called `____________` +9. A `____________` computer is likely to run a word processor and Web browser. + +# Chapter 3 + +## Suggested Exercises + +* Look up the GPLv2, GPLv3, and BSD 2-clause licenses. http://www.opensource.org/licenses/ is a good place to find them all.) Read them and compare them. Which would you use if you were to write an open source program? +* Read the OSI mission statement (three paragraphs at the top of its main Web page at http://www.opensource.org and the "Our Core Work" section of the FSF's "About" page http://www.fsf.org/about/. + +## Review Questions + +1. Which of the following is **not** required in order for software to be certified as open source? + A. The license must not discriminate against people or groups of people. + B. The license must not require that the software be distributed as part of a specific product. + C. The license must require that changes be distributed under the same license. + D. The program must come with source code, or the author must make it readily available on the Internet. + E. The license must automatically apply to anybody who acquires the software. +2. Which is true of Linux distributions as a whole? + A. They're covered by the GPL or the BSD license, depending on the distribution. + B. Sometimes, they may not be copied because of non-open source software they may contain. + C. They may be copied only after software using the MIT license is removed. + D. They all completely conform to the principles of the open source movement. + E. They all qualify as free software, as the FSF uses the term. +3. Which of the following is a key part of the FSF's philosophy? + A. Developers should use the latest version of the FSF's GPL. + B. Users should have the right to modify free software and distribute it under a commercial license. + C. Developers should write software only for free operating systems such as GNU/Linux. + D. Users should engage in civil disobedience by copying proprietary software. + E. Users must have the right to use software as they see fit. +4. True or false: Copyright law governs the distribution of software in most countries. +5. True or false: The FSF's free software definition and the OSI's ten principles of open source software both require that users have the ability to examine a program's workings---that is, its source code. +6. True or false: Because their hardware designs are proprietary, hardware vendors cannot release open source drivers for their products. +7. A license created by the FSF and often used for libraries is the `____________`. +8. An organization devoted to promoting open source-like principles in fields such as video and audio recordings is the `____________`. +9. The FSF's general principles are summarized by the term `____________` which refers to using copyright laws for purposes that are in some ways contrary to copyright's original intent. + +# Chapter 4 + +## Suggested Exercises + +* Try at least two different desktop environments. Use each desktop environment for your normal computing tasks for a day or two so that you can decide which you prefer. +* Try at least two different Linux Web browsers. Use each to visit your favorite Web sites. Do you notice differences in speed or how the elements on the page are laid out? Which do you prefer? + +## Review Questions + +1. Which of the following are Linux desktop environments? (Select all that apply.) + A. GTK+ + B. GNOME + C. KDE + D. Evolution + E. Xfce +2. If you want to enable one Linux computer to access files stored on another Linux computer's hard disk, which of the following network protocols is the *best* choice? + A. SMTP + B. NFS + C. PHP + D. DNS + E. DHCP +3. In which of the following languages was most of the Linux kernel written? + A. Bash shell script + B. Java + C. C + D. C++ + E. Perl +4. True or false: OpenOffice.org and LibreOffice are very similar office suites. +5. True or false: Servers can be disrupted by malicious outsiders even if the computer that runs them is never broken into. +6. True or false: Python is generally implemented as an interpreted language. +7. Thunderbird is a(n) `____________` program. (Specify the general category of the software.) +8. A Linux server that handles the SMB/CIFS protocol normally runs the `____________` software. +9. A program written in a(n) `____________` programming language is completely converted to binary form before being run. + +# Chapter 5 + +## Suggested Exercises + +* At a Linux shell prompt, type `uname -a`, `lscpu`, and `cat /proc/cpuinfo` [Compare the output and try to determine your CPU's capabilities. In particular, can it run 64-bit applications, and is your current distribution a 32-bit or 64-bit distribution? +* After you've logged into your preferred desktop environment, insert an optical disc, a USB flash drive, or some other removable disk. Does a file browser open up? If not, open one manually and try to find your removable disk. Once you've accessed the disk, unmount it so that you can safely remove it. + +## Review Questions + +1. Which of the following commands provides the most information about your motherboard's features? + A. `lscpu` + B. `Xorg -configure` + C. `fdisk -l /dev/sda` + D. `lspci` + E. `http://localhost:631` +2. Why might you want to partition a hard disk? (Select all that apply.) + A. To install more than one OS on the disk + B. To use ext4fs rather than ReiserFS + C. To turn a PATA disk into an SATA disk + D. To separate filesystem data from swap space + E. To separate the disk's cache from its main data +3. Which of the following devices is *not* commonly attached via USB? + A. Video monitors + B. Keyboards + C. External hard disks + D. Printers + E. Scanners +4. True or false: An EM64T CPU is capable of running a Linux distribution identified as being for the AMD64 CPU. +5. True or false: UDF is a good filesystem to use for a Linux installation on a hard disk. +6. True or false: The Linux kernel includes drivers for various disk controllers, network adapters, and USB interfaces, among other things. +7. The x86 CPU uses a `____________`-bit architecture. +8. A computer power supply converts electricity from alternating current to `____________`. (Two words) +9. The `____________` standard is a modern video interface that's commonly used on computer monitors. + +# Chapter 6 + +## Suggested Exercises + +* Read the `man` pages for the following commands: `man`, `less`, `cat`, `cd`, `ls`, `grep` and `su`. +* Launch a GUI program, such as `gedit`, with and without a trailing ampersand `&`. When you launch it without an ampersand, use Ctrl+Z to put it into the background and see how the program reacts to mouse clicks. Use `fg` to return it to the foreground, then repeat the process but use `bg` to run the program in the background. See what happens in your terminal when you exit from the GUI program. +* In a shell, type a single letter, such as `m`, and press the Tab key. What happens? What happens if you type a less common letter, such as `z`, and then press Tab? +* Experiment with the command history. Use it to search on strings that are part of both command names and filenames you've used. + +## Review Questions + +1. What keystroke moves the cursor to the start of the line when typing a command in Bash? + A. Ctrl+A + B. Left arrow + C. Ctrl+T + D. Up arrow + E. Ctrl+E +2. How can you run a program in the background when launching it from a shell? (Select all that apply.) + A. Launch the program by typing `start command`, where `command` is the command you want to run. + B. Launch the program by typing `bg command`, where `command` is the command you want to run. + C. Append an ampersand `&` to the end of the command line. + D. Launch the program normally, type Ctrl+Z in the shell, and then type `bg` in the shell. + E. Launch the program normally, type Ctrl+Z in the shell, and then type `fg` in the shell. +3. Which of the following commands, typed at a Bash prompt, returns you to your home directory? + A. `home` + B. `cd /home` + C. `cd homedir` + D. `homedir` + E. `cd ~` +4. True or false: The Alt+F2 keystroke, typed in X, brings up a text-mode display you can use to log into Linux. +5. True or false: The filename `..\\upone.txt` refers to the file `upone.txt` in the parent of the current directory. +6. True or false: The `-r` option to `ls` creates a recursive directory listing. +7. The `____________` command displays the path to the current working directory. +8. To view all files, including hidden files and directories, in the current directory, you would type `ls` `____________`. +9. The `____________` command displays text files or can concatenate multiple files together. + +# Chapter 7 + +## Suggested Exercises + +* Create a file with `touch` (or some other program) and then practice copying it with `cp`, renaming it with `mv`, moving it to another directory with `mv` and deleting it with `rm`. +* Create a directory with `mkdir` and then practice using `cp`, `mv` and `rm` on it, just as with files. Try copying files into it and then try deleting the directory with both `rmdir` and `rm`. Do both commands work? + +## Review Questions + +1. Which of the following commands would you type to rename `newfile.txt` to `file.txt`? + A. `mv newfile.txt afile.txt` + B. `cp newfile.txt afile.txt` + C. `ln newfile.txt afile.txt` + D. `rn newfile.txt afile.txt` + E. `touch newfile.txt afile.txt` +2. You want to copy a directory, `MyFiles`, to a USB flash drive that uses the FAT filesystem. The contents of `MyFiles` are as follows: +```bash +$ ls -l MyFiles/ +total 276 +-rw-r--r-- 1 jen users 129840 Nov 8 15:13 contract.odt +-rw-r--r-- 1 rod users 42667 Nov 8 15:12 outline.pdf +-rw-r--r-- 1 sam users 105979 Nov 8 15:12 Outline.PDF +``` +The USB flash drive is mounted at `/media/usb`, and so you type `cp -a MyFiles /media/`. What problem will occur when you attempt to copy these files? + A. The command will fail because it tries to create links. + B. The `MyFiles` directory will be copied, but none of its files will be copied. + C. One file will be missing on the USB flash drive. + D. One file's name will be changed during the copy. + E. Everything will be fine; the command will work correctly. +3. You type `mkdir one/two/three` and receive an error message that reads, in part, `No such file or directory`. What can you do to overcome this problem? (Select all that apply.) + A. Add the `--parents` parameter to the `mkdir` command. + B. Issue three separate `mkdir` commands: `mkdir one`, then `mkdir one/two`, and then `mkdir one/two/three`. + C. Type `touch /bin/mkdir` to be sure the `mkdir` program file exists. + D. Type `rmdir one` to clear away the interfering base of the desired new directory tree. + E. Type `rm -r one` to clear away the entire interfering directory tree. +4. True or false: You can create a symbolic link from one low-level filesystem to another. +5. True or false: You can easily damage your Linux installation by mistyping an `rm` command when you log into your regular account. +6. True or false: You can set a directory's time stamps with the `touch` command. +7. You want to copy a file `origfile.txt` to the `backups` directory, but if a file called `origfile.txt` exists in the `backups` directory, you want to go ahead with the copy only if the file in the source location is newer than the one in `backups`. The command to do this is `cp ____________ origfile.txt backups/`. +8. You've typed `rmdir junk` to delete the `junk` directory, but this command has failed because `junk` contains word processing files. What command might you type to do the job? +9. Which wildcard character matches any one symbol in a filename? + +# Chapter 8 + +## Suggested Exercises + +* Fully read at least three `man` pages for common Linux commands, such as `ls`, `cp`, `cat`, or `less`. What have you learned about these commands that goes beyond the descriptions in this book? +* Search `/usr/share/doc` for documentation on important programs you use frequently, such as the GIMP, Firefox, or GNOME. +* Check your distribution's Web site, or do a Web search, to find a Web forum supporting your distribution. Read some of the discussion threads to get a feel for some of the topics that come up. + +## Review Questions + +1. Which of the following commands is an improved version of `more`? + A. `grep` + B. `html` + C. `cat` + D. `less` + E. `man` +2. Which of the following statements is a fair comparison of `man` pages to HOWTO documents? + A. `man` pages require Internet access to read; HOWTOs do not. + B. `man` pages are a type of printed documentation; HOWTOs are electronic. + C. `man` pages describe software from a user's point of view; HOWTOs are programmers' documents. + D. `man` pages are brief reference documents; HOWTOs are more tutorial in nature. + E. `man` pages use a hyperlinked format, whereas HOWTOs do not. +3. A user types `whatis less`. What type of output can be expected? + A. A short one-paragraph description of the purpose of the `less` command + B. The complete path to the `less` command in the Linux filesystem + C. Summary information from `man` pages whose Name sections mention `less` + D. The complete `man` page for `less`, which you would then scroll through with your terminal + E. The URLs for Web sites with information on the `less` command +4. True or false: You can force `man` to display a `man` page in a specific section of the manual by preceding the search name with the section number, as in `man 5 passwd`. +5. True or false: `info` pages are a Web-based documentation format. +6. True or false: Linux documentation in the `/usr/share/doc` directory tree is almost always in OpenDocument Text format. +7. File formats are described in `man` section `____________`. +8. Each document in an `info` page is known as a(n) `____________`. +9. The `____________` command searches a database of filenames, enabling you to quickly identify files whose names match a term you specify. + +# Chapter 9 + +## Suggested Exercises + +* Is your distribution's software up to date? Locate the option in your desktop environment's menus to run a package manager and check that the system is up to date. A computer running out-of-date software can be vulnerable to bugs and security threats, so keeping your software updated is important! +* Type `ps ax | less` and browse through the process list. You might not recognize many of the processes, but some should be familiar. Try using `man` or a Web search to learn more about some of the processes you don't recognize. + +## Review Questions + +1. Which of the following tools is best suited to installing a software package and all its dependencies on a Debian computer? + A. `yum` + B. `zypper` + C. `dmesg` + D. `rpm` + E. `apt-get` +2. What is the usual name of the first process that the Linux kernel runs, aside from itself? + A. `init` + B. `bash` + C. `cron` + D. `login` + E. `grub` +3. Where do most log files reside on a Linux computer? + A. `/var/log` + B. `/etc/logging` + C. `/usr/log` + D. `/home/logging` + E. `/log/usr` +4. True or false: When using suitable commands, you can normally install a program and be sure that all the software on which it depends will also be installed, provided you have an Internet connection. +5. True or false: By default, the first process listed in `top` is currently consuming the most CPU time. +6. True or false: The `dmesg` command may produce different output after a computer has been running for weeks than when it first started. +7. Most Linux distributions maintain information on what packages are installed in the `____________` `____________`. (Two words.) +8. You're using `bash`, and you type `emacs` to launch the `emacs` editor. In this case, `emacs` is `bash`'s `____________`. +9. General system messages are likely to be found in `/var/log/messages` or `/var/log/____________` depending on your distribution. + +# Chapter 10 + +*Searching, Extracting, and Archiving Data* + +## Suggested Exercises + +* Use `find` and `grep` to locate files in your own directory and on the Linux computer at large. For instance, try locating references to your own username in configuration files in `/etc`. +* Use `gzip`, `bzip2`, and `xz` to compress a couple instances of files of various types, such as text files and digital photos. What file types compress well? Which compression tool works best for each file type? + +## Review Questions + +1. Which of the following commands will print lines from the file `world.txt` that contain matches to `changes`and `changed`? + A. `grep change[ds] world.txt` + B. `tar change[d-s] world.txt` + C. `find "[change\'d\|s]\'" world.txt` + D. `cat world.txt changes changed` + E. `find change[\^ds] world.txt` +2. Which of the following redirection operators appends a program's standard output to an existing file, without overwriting that file's original contents? + A. `|` + B. `2>` + C. `&>` + D. `>` + E. `>>` +3. You've received a tarball called `data79.tar` from a colleague, but you want to check the names of the files it contains before extracting them. Which of the following commands would you use to do this? + A. `tar uvf data79.tar` + B. `tar cvf data79.tar` + C. `tar xvf data79.tar` + D. `tar tvf data79.tar` + E. `tar Avf data79.tar` +4. True or false: The regular expression `Linu[^x].*lds` matches the string `Linus Torvalds`. +5. True or false: The `find` command enables you to locate files based on their sizes. +6. True or false: To compress files archived with `zip`, you must use an external compression program such as `gzip` or `bzip2` in a pipeline with `zip`. +7. The character that represents the start of a line in a regular expression is `____________`. +8. Complete the following command to redirect both standard output and standard error from the `bigprog` program to the file `out.txt`. `$ bigprog ____________ out.txt` +9. The `gzip`, `bzip2`, and `xz` programs all perform `____________` compression, in which the decompressed data exactly match the original pre-compression data. + +# Chapter 11 + +*Editing Files* + +## Suggested Exercises + +* Launch `nano` to create a new file and type in a complete paragraph from this chapter. Proofread the text and correct any typos you find. (If you found none, congratulations! Now create a few "errors" and correct them.) +* Type `Listing 11-2` into `vi` and save it. Point a Web browser at the file (for instance, by typing file:///home/yourusername/sample.html into a Web browser's address field, if you saved it as `~/sample.html`). Add a new paragraph by cutting and pasting the existing paragraph and changing the text. Reload the file to see how your Web browser renders it. + +## Review Questions + +1. Which type of file is `nano` *least* likely to be useful for examining or editing? + A. A `/var/log/messages` log file + B. An HTML Web page file + C. An e-mail message saved from an e-mail client + D. A LibreOffice word processing document + E. An `/etc/X11/xorg.conf` configuration file +2. Which keystrokes invoke the `pico` or `nano` search function? (Select all that apply.) + A. F3 + B. F6 + C. Esc-S + D. Ctrl+F + E. Ctrl+W +3. How would you remove two lines of text from a file using Vi? + A. In command mode, position the cursor on the first line and type `2dd`. + B. In command mode, position the cursor on the last line and type `2yy`. + C. In insert mode, position the cursor at the start of the first line, hold down the Shift key while pressing the Down arrow key twice, and press the Delete key on the keyboard. + D. In insert mode, position the cursor at the start of the first line and press Ctrl+K twice. + E. Select the text with the mouse and then select File ⇒ Delete from the menu. +4. True or false: Unicode is useful for encoding most European languages but not Asian languages. +5. True or false: GUI text editors for ASCII are superior to text-mode ASCII text editors because the GUI editors support underlining, italics, and multiple fonts. +6. True or false: Many (but not all) configuration files use a hash mark `#` to identify comment lines. +7. ASCII supports `____________` unique characters. +8. Three keystrokes that can initiate a search-and-replace operation in `nano` are F14, `____________` and `____________`. +9. While in Vi's command mode, you can type `____________` to undo a change. + D. Ctrl+F + E. Ctrl+W + +# Chapter 12 + +*Creating Scripts* + +## Suggested Exercises + +* Write a script that copies a file by prompting the user to enter the source and destination filenames rather than by accepting them as arguments on the command line, as `cp` does. +* Some text editors leave backup files with filenames that end in tildes `~`. Write a script that, when you pass it a directory name as an argument, locates all such files in that directory. The script should then ask the user whether to delete each file individually and do so if and only if the user responds by typing `Y`. + +## Review Questions + +1. After using a text editor to create a shell script, what step should you take before trying to use the script by typing its name? + A. Set one or more executable bits using `chmod`. + B. Copy the script to the `/usr/bin/scripts` directory. + C. Compile the script by typing `bash scriptname`, where `scriptname` is the script's name. + D. Run a virus checker on the script to be sure it contains no viruses. + E. Run a spell checker on the script to ensure it contains no bugs. +2. Describe the effect of the following short script, `cp1`, if it's called as `cp1 big.c big.cc`: +```bash +#!/bin/bash +cp $2 $1 +``` + A. It has the same effect as the `cp` command, copying the contents of `big.c` to `big.cc`. + B. It compiles the C program `big.c` and calls the result `big.cc`. + C. It copies the contents of `big.cc` to `big.c`, eliminating the old `big.c`. + D. It converts the C program `big.c` into a C++ program called `big.cc`. + E. The script's first line is invalid, so it won't work. +3. What is the purpose of conditional expressions in shell scripts? + A. They prevent scripts from executing if license conditions aren't met. + B. They display information about the script's computer environment. + C. They enable the script to take different actions in response to variable data. + D. They enable scripts to learn in a manner reminiscent of Pavlovian conditioning. + E. They cause scripts to run only at specified times of day. +4. True or false: A user types `myscript laser.txt` to run a script called `myscript`. Within `myscript`, the `$0` variable holds the value `laser.txt`. +5. True or false: Valid looping statements in Bash include `for`, `while`, and `until`. +6. True or false: The following script launches three simultaneous instances of the `terminal` program. +```bash +#!/bin/bash +terminal +terminal +terminal +``` +7. You've written a simple shell script that does nothing but launch programs. In order to ensure that the script works with most user shells, what should its first line read? +8. What command can you use to display prompts for a user in a shell script? +9. What Bash scripting command can you use to control the program flow based on a variable that can take many values (such as all the letters of the alphabet)? + +# Chapter 13 + +*Understanding Users and Groups* + +## Suggested Exercises + +* Type `whoami` followed by `id` to review your ordinary user account status. Chances are the `id` command will reveal that you're a member of a number of groups. Perform a Web search to learn what each one does. +* Read the `/etc/passwd` file to review what accounts are defined on the computer. Are there ordinary user accounts (those with UIDs above 500 or 1000, depending on your distribution) other than your own? Try performing a Web search to learn the purpose of a few of the system accounts (those with UIDs below 500 or 1,000, depending on your distribution). + +## Review Questions + +1. What is the purpose of the system account with a UID of 0? + A. It's the system administration account. + B. It's the account for the first ordinary user. + C. Nothing; UID 0 is left intentionally undefined. + D. It varies from one distribution to another. + E. It's a low-privilege account that's used as a default by some servers. +2. What type of information will you find in `/etc/passwd` for ordinary user accounts? (Select all that apply.) + A. A user ID (UID) number + B. A complete listing of every group to which the user belongs + C. The path to the account's home directory + D. The path to the account's default GUI desktop environment + E. The path to the account's default text-mode shell +3. You want to run the command `iptables -L` as `root` but you're logged in as an ordinary user. Which of the following commands will do the job, assuming the system is configured to give you `root` access via the appropriate command? + A. `sudo iptables -L` + B. `root iptables -L` + C. `passwd iptables -L` + D. `su iptables -L` + E. `admin iptables -L` +4. True or false: `whoami` provides more information than `id`. +5. True or false: Linux stores information on its groups in the `/etc/groups` file. +6. True or false: As a general rule, you should employ extra care when running programs as `root`. +7. The file that associates usernames with UID numbers in Linux is `____________` (Provide the complete path to the file.) +8. To learn who is currently logged into the computer and what programs they're currently running, you can type `____________`. +9. UIDs below 500 or 1,000 (depending on the distribution) are reserved for use by `____________` accounts. + +# Chapter 14 + +*Creating Users and Groups* + +## Suggested Exercises + +* Create a test account using User Manager (or another GUI tool provided by your distribution) and then log into the account you've created to verify that it's working as you expected. +* Do the same using `useradd`, but do *not* use `passwd` to set its password. Were you able to log in? Use `passwd` and try logging in again. + +## Review Questions + +1. What would a Linux system administrator type to remove the `nemo` account and its home directory + A. `userdel nemo` + B. `userdel -f nemo` + C. `userdel -r nemo` + D. `rm /home/nemo` + E. `rm -r /home/nemo` +2. Of the following, which is the *best* password? + A. `LinusTorvalds` + B. `uB2op%4q****************` + C. `123456` + D. `password` + E. `peanutbuttersandwich` +3. Describe the effect of the following command, assuming it completes successfully: `groupadd henry` + A. It creates a new group called `henry`. + B. It adds the user `henry` to the current default group. + C. It imports group information from the file called `henry`. + D. It changes the user's default group to `henry`. + E. It adds the group `henry` to the user's list of groups. +4. True or false: User accounts have higher UID numbers than do system accounts. +5. True or false: Command-line users should normally use `usermod` to change their passwords. +6. True or false: After deleting an account, files formerly owned by the deleted account may remain on the computer. +7. You want to create an account for a new user, using the username `theo` and giving the user a UID of 1926. The command to do this is `useradd ____________`. +8. You want to change the username of a user from `e1211` to `emilyn`, without altering anything else about the account. To do so, you would type `____________`. +9. To create a system account, you must pass the `____________` option to `groupadd`. + +# Chapter 15 + +*Setting Ownership and Permissions* + +## Suggested Exercises + +* As `root`, copy a file that you created as an ordinary user, placing the copy in your ordinary user home directory. Using your normal account, try to edit the file with a text editor and save your changes. What happens? Try to delete that file with the `rm` command. What happens? +* Create a scratch file as an ordinary user. As `root`, use `chown` and `chmod` to experiment with different types of ownership and permissions to discover when you can read and write the file using your normal login account. +* Use the `ls -l` command to view the ownership and permissions of files in your home directory, in `/usr/bin` (where many program files reside), and in `/etc` (where most system configuration files reside). What are the implications of the different ownership and permissions you see for who can read, write, and execute these files? + +## Review Questions + +1. What command would you type (as `root`) to change the ownership of `somefile.txt` from `ralph` to `tony`? + A. `chown ralph:tony somefile.txt` + B. `chmod somefile.txt tony` + C. `chown somefile.txt tony` + D. `chown tony somefile.txt` + E. `chmod tony somefile.txt` +2. Typing `ls -ld wonderjaye` reveals a symbolic file mode of `drwxr-xr-x`. Which of the following are true? (Select all that apply.) + A. `wonderjaye` is a symbolic link. + B. `wonderjaye` is an executable program. + C. `wonderjaye` is a directory. + D. `wonderjaye` may be read by all users of the system. + E. `wonderjaye` may be written by any member of the file's group. +3. Which of the following commands can you use to change a file's group? + B. `groupmod` + C. `chmod` + D. `ls` + E. `chown` +4. True or false: A file with permissions of 755 can be read by any user on the computer, assuming all users can read the directory in which it resides. +5. True or false: Only `root` may use the `chmod` command. +6. True or false: Only `root` may change a file's ownership with `chown`. +7. What option causes `chown` to change ownership on an entire directory tree? +8. What three-character symbolic string represents read and execute permission but no write permission? +9. What symbolic representation can you pass to `chmod` to give all users execute access to a file, without affecting other permissions? + +# Chapter 16 + +*Navigating the LinuxFilesystem* + +## Suggested Exercises + +* Examine the names of configuration files in `/etc` and try to find matching program files in `/bin`, `/sbin`, `/usr/bin`, and `/usr/sbin`. Examine the configuration files with `less` or a text editor and read their `man` pages. (Don't do this for *all* the configuration files in `/etc`, though, that would take forever! A couple will suffice.) +* Experiment with the sticky bit on a "scratch" directory. Using your regular account and either another regular account or the `root` account, set the ownership and sticky bit on the scratch directory in different ways and test whether you can delete and modify files in the directory. + +## Review Questions + +1. What types of files are you likely to find in `/usr/lib`, according to the FHS? + A. Liberty files + B. Liberated files + C. Libra files + D. Library files + E. Liberal files +2. You want to discover the sizes of several dot files in a directory. Which of the following commands might you use to do this? + A. `ls -la` + B. `ls -p` + C. `ls -R` + D. `ls -d` + E. `ls -ld` +3. When should programs be configured SUID `root`? + A. At all times; this permission is required for executable programs. + B. Whenever a program should be able to access a device file. + C. Only when they require `root` privileges to do their job. + D. Whenever the program must be able to access an account's user ID (UID) number. + E. Never; this permission is a severe security risk. +4. True or false: Print spool files are stored in a subdirectory of `/var`. +5. True or false: On a properly configured Linux system, any user can delete any file from `/tmp`. +6. True or false: If you hide a file in Linux by making it a dot file, you must change any existing references to that file in configuration files if those references are to continue working. +7. Typically, optical discs and USB flash drives are mounted in subdirectories of `/mnt` or `____________`. +8. Temporary files that are guaranteed to *not* be deleted during a reboot reside in `____________`. +9. You want to set the sticky bit on an existing directory, `subdir`, without otherwise altering its permissions. To do so, you should type `chmod ____________ subdir`. + +# Chapter 17 + +*Managing Network Connections* + +## Suggested Exercises + +* On a small private network that you control or in a lab environment under the supervision of an instructor, reconfigure a computer that normally uses DHCP to use its assigned IP address in a static fashion. Test the connection, and then switch back to DHCP. +* *Do not perform this test on a work or school network that's used for normal purposes*; misconfiguration of a computer's IP address can cause problems for other computers. +* Back up your `/etc/resolv.conf` file and then edit the original so that its `nameserver` lines point to computers that don't run DNS servers. Test your network configuration by attempting to access remote servers using `ping`, a Web browser, and other utilities. Observe the types of failures that result. When you're done, restore the original file. + +## Review Questions + +1. You want to set up a computer on a local network via a static TCP/IP configuration, but you lack a gateway address. Which of the following is true? + A. Because the gateway address is necessary, no TCP/IP networking functions will work. + B. TCP/IP networking will function, but you'll be unable to convert hostnames to IP addresses, and vice versa. + C. You'll be able to communicate with machines on your local network segment but not with other systems. + D. The computer won't be able to tell which other computers are local and which are remote. + E. You'll be able to use the computer as a network server system, but not as a network client. +2. Which of the following types of information are returned by typing `ifconfig eth0`? (Select all that apply.) + A. The names of programs that are using `eth0` + B. The IP address assigned to `eth0` + C. The hardware address of `eth0` + D. The hostname associated with `eth0` + E. The gateway with which `eth0` communicates +3. The `ping` utility responds normally when you use it with an IP address but not when you use it with a hostname that you're positive corresponds to this IP address. What might cause this problem? (Select all that apply.) + A. The route between your computer and its DNS server may be incorrect. + B. The target computer may be configured to ignore packets from `ping`. + C. The DNS configuration on the target system may be broken. + D. Your computer's hostname may be set incorrectly. + E. Your computer's DNS configuration may be broken. +4. True or false: IPv4 addresses are four bytes in length. +5. True or false: The `/etc/resolv.conf` file tells the computer whether to use DHCP for its network configuration. +6. True or false: You can check the current status of your routing table by typing `route` at a shell prompt. +7. The `____________` program serves as a multi-purpose network tool; it can do many of the same things as `ifconfig`, `route`, and several others. +8. The traditional name for the first Ethernet interface in Linux (but not in recent versions of Fedora) is `____________`. +9. A `____________` is a program or system configuration that blocks or enables network access to, from, or through a computer based on criteria you specify. +