Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
47
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

324 Chapter 9 Study Guide

4.Return to the login directory and verify the directory.

5.Create a file in the home directory without opening an editor.

6.Copy that file to another directory on the system, try several and notice any that disallow access.

7.Create another file then move that file from directory to directory.

8.Remove all files that were created by navigating to the directory they are located in and listing them before removal.

Lab 9-2 Mounting and un-mounting drives

The objective for this hands-on lab is to gain experience in mounting and unmounting. You should be able to use any distribution of Linux for this installation exercise.

1.Log in to the Linux system.

2.Use the proper commands to view the current mounted directories and devices.

3.Mount a diskette using a method that verifies that the mount was successful.

4.Un-mount the diskette.

5.Attempt to un-mount a system directory; take note of what can and can’t be dismounted.

6.Repeat as often as possible trying several of the options available.

Answers to Chapter Questions

Chapter Pre-test

1.The creation of a user normally requires a user name, password, group assignment, user rights, and real world information, such as name, location, and contact numbers.

2.You need to know who is to be assigned to the group, what files and directories the group needs access to, and a name for the group.

3.The adduser command is the most often used command line method, and several GUI programs are available to create and manage users, such as kuser for KDE.

Chapter 9 Study Guide 325

4.The groupadd command is the most often used command line method of adding groups to a Linux system. Several GUI programs are available for creating and managing groups,

5.The common directories in Linux are /, /bin, /boot, /dev, /etc, /home, /lib, /mnt, /opt, /proc, /root, /sbin, swap, /tmp, /usr, /usr/local and /var.

6.The common commands are ls, cd, cp, mv rm, touch, mkdir, and rmdir.

7.The common commands used to mount and manage file systems are mount, umount, du, df, mkfs, and fsck.

8.The use of chmod, chown, and chgrp are used to identify and manage file permissions

9.Normally, all commands used to manage the Linux system require root access.

10.Normally, users have no rights to manage users, groups, directories, file systems, or permissions.

Assessment Questions

1.A. The command adduser john should be used to add the user name john for Johnny Jones. The others won’t create the proper account. For review, see the “Creating users” section.

2.B. The command adduser -e 2005-12-25 contractor is used to add the user name contractor that is disabled on December 25, 2005. The others will fail to create the user correctly. For review, see the “Creating users” section.

3.C. The chfn command is used to provide information for the finger command. The chmod and chgrp commands are used for access rights and the chsh command is used to change the login shell. For review, see the “Change user information” section.

4.D. The command userdel -r <user name> is used to remove a user and the user’s home directory, including the user’s files and mail spool. The -r option performs this task; the -d and -h options are not valid. For review, see the “Deleting users” section.

5.B. The files modified when performing any action on a group are /etc/group and /etc/gshadow. The others are not the typically files on a Linux system. For review, see the “Creating groups” section.

6.A.The groupdel command will delete a group from a Linux system. The groupmod will modify a group and the others are not typical programs used to perform group management. For review, see the “The groupdel command” section.

326 Chapter 9 Study Guide

7.D. The command that displays the current directory is the print working directory or pwd command. The others won’t display the current directory. For review, see the “The pwd and cd commands” section.

8.C. The command cd /etc/X11 will move the user to the /etc/X11 directory. The others fail due to the use of ls or a missing /. For review, see the “The pwd and cd commands” section.

9.C. The ls -l command will display a long listing format, including access rights. The -a option provides all entries, including all those normally not displayed; -n provides a list in long format but no access rights; and -i prints the i-node number for each file. For review, see the “The ls command” section.

10.C. The command [john@dhcppc1 john]$ cp /home/john/myfile /tmp/ will move the file named myfile from the home directory of user john to the /tmp directory. The others won’t perform the task. For review, see the “The cp command” section.

11.B. The correct format for the move command is mv [options] [source] [destination]. The use of <file name> is not used. For review, see the “The mv command” section.

12.B. The command used to remove a file interactively is rm -i <file name> due to the use of the -i option. The other options don’t provide an interactive environment. For review, see the “The rm command” section.

13.C. The x option is used to allow execute only if the file is a directory. The r (read), w (write), and x (execute) don’t perform this task. For review, see the “Setting File and Directory permissions” section.

14.A.The command chown --verbose user2 /tmp/newfile will display confirmation of the change of ownership of a file from user to user2. The -v and -f options don’t provide confirmation and the chgrp command won’t change ownership of the file for a user. For review, see the “The chown command” section.

15.C. The command chgrp is used to change only the group ownership of a file. The others provide a different service. For review, see the “The chgrp command” section.

16.B. The command mount -f /mnt/win_c2 won’t mount the file system /mnt/win_c2 due to the -f option. The other options won’t fake the mount command. For review, see the “Mount” section.

17.D. The file system most likely to require the -t option is smbfs. The other file systems are normally mounted automatically by the mount command. For review, see the “Mount” section.

18.C. The command umount -v /mnt/floppy would un-mount a diskette and provide verification of the dismount. The other options don’t provide verification. For review, see the “Umount” section.

Chapter 9 Study Guide 327

19.C. The command du -c -s /home/user will display the total size of all files, without listing the files. The -c and -s options are required to provide the features needed. For review, see the “The du Command” section.

20.C. The command df -m will display the available space of each partition in MB. The -M is not used and the du command doesn’t provide the correct information. For review, see the “The df Command” section.

Scenarios

1.You can move the users to a group called remove by using the chgrp command to remove any group affiliations, and then remove all their files by using the userdel -r.

2.The best way to justify the replacement or the denied replacement is to use the df command to verify the free space on the sales manager’s current drive.

Linux Terminals

and Shells

4.7 Perform administrative tasks while logged in as root, or by using the su command (e.g., understand commands that are dangerous to the system)

4.9 Describe and use the features of the multi-user environment (e.g., virtual terminals, multiple logins)

4.10 Use common shell commands and expressions

4.11 Use network commands to connect to and manage remote systems (e.g., telnet, ftp, ssh, netstat, transfer files, redirect Xwindow)

4.17 Manage and navigate the Graphical User Interface (e.g., menus, xterm)

4.18 Program basic shell scripts using common shell commands (e.g., grep, find, cut, if)

10C H A P T E R

330 Part IV Administration

CHAPTER PRE-TEST

1.Is Linux a multi-user operating system?

2.Can multiple users simultaneously access a Linux system?

3.How does Linux provide multi-user access on the same terminal?

4.Can Linux provide Ethernet-based terminals?

5.Can Linux monitor remote connections?

6.What shells are commonly used in Linux?

7.What is the most common shell used in Linux?

8.What can you use to perform repetitive tasks in Linux?

9.What can you use to schedule tasks in Linux?

10.What is a “best practice” way to login as root?

Answers to these questions can be found at the end of the chapter.