5. a. The variable must be set and exported. The semicolon separates the two commands. The variable must be set and exported. The semicolon separates the two commands.

6. c. UPDATE UPDATE 7. a. 01;02;03;04;05;06;07;08;09;10 01;02;03;04;05;06;07;08;09;10. The -w -w option to option to seq seq instructs it to pad with zeros. instructs it to pad with zeros.

8. a. cp cp should be aliased to the interactive mode with the should be aliased to the interactive mode with the -i -i option in option in .bashrc .bashrc. .bash_profile .bash_profile normally doesn"t include aliases. normally doesn"t include aliases.

9. e. The script has an error and will not produce the expected output. In a The script has an error and will not produce the expected output. In a for for statement, the loop variable does not have the dollar sign. Changing line 2 to statement, the loop variable does not have the dollar sign. Changing line 2 to for for v1 v1 in a1 a2 in a1 a2 will correct the error and produce the output in answer b. will correct the error and produce the output in answer b.

10. d. The shadow pa.s.sword system has been implemented, placing all pa.s.swords in The shadow pa.s.sword system has been implemented, placing all pa.s.swords in /etc/shadow /etc/shadow as denoted by the as denoted by the x x following the username. following the username.

11. d. /etc/X11/xorg.conf /etc/X11/xorg.conf 12. c. ~/.Xresources ~/.Xresources 13. d. Graphical login support for remote hosts on the network Graphical login support for remote hosts on the network 14. d. xfce xfce and e. and e. X11 X11.

15. c. An a.s.sistive technology that handles screen reading for a number of console applications An a.s.sistive technology that handles screen reading for a number of console applications 16. c. The The g g indicates that we"re operating on the group privilege, and the indicates that we"re operating on the group privilege, and the +s +s indicates that we should add the "set id" bit, which means that the SGID property will be applied. indicates that we should add the "set id" bit, which means that the SGID property will be applied.

17. b. /etc/syslog.conf /etc/syslog.conf 18. c. Qmail Qmail 19. d. /var/log/maillog /var/log/maillog 20. e. With the top bit of the last byte set in the subnet mask (.128), there are 7 bits left. 2 With the top bit of the last byte set in the subnet mask (.128), there are 7 bits left. 27 is 128, less the network address and broadcast address, leaving 126 addresses for hosts. is 128, less the network address and broadcast address, leaving 126 addresses for hosts.

21. d. Routes to the interface and the network are required to exchange information on the local LAN. To access the Internet or other nonlocal networks, a default gateway is also necessary. Routes to the interface and the network are required to exchange information on the local LAN. To access the Internet or other nonlocal networks, a default gateway is also necessary.

22. c. As defined in As defined in /etc/services /etc/services, port 25 is the SMTP port, often monitored by postfix postfix.

23. a. TCP. UDP is also a Layer 4 protocol, but it is connectionless. TCP. UDP is also a Layer 4 protocol, but it is connectionless.

24. b. The The ifconfig ifconfig command is used to configure and display interface information. command is used to configure and display interface information. ipconfig ipconfig is a Windows utility. is a Windows utility.

25. b. The spool directory directive looks like this: The spool directory directive looks like this:sd=/var/spool/lpd/lp 26. c. Answer a attempts to mount the Answer a attempts to mount the /proc /proc filesystem. Answers b, d, and e have incorrect syntax. filesystem. Answers b, d, and e have incorrect syntax.

27. c. Both Telnet and FTP are connection-oriented and use TCP for reliable connections. Both Telnet and FTP are connection-oriented and use TCP for reliable connections.

28. a, b b, d d, AND e. e.

29. c. Although both ICMP and UDP are connectionless, they are different protocols. Although both ICMP and UDP are connectionless, they are different protocols.

30. The DNS daemon is named named. It is included in a package called BIND.

31. b. A print server translates formats, such as PostScript to PCL. A print server translates formats, such as PostScript to PCL.

32. d. The presence of the The presence of the localhost localhost address 127.0.0.1 indicates that address 127.0.0.1 indicates that named named is running. Since the system is a workstation, it"s safe to a.s.sume that it is not serving DNS to a wider community. is running. Since the system is a workstation, it"s safe to a.s.sume that it is not serving DNS to a wider community.

33. /etc/hosts.

34. e. lpc lpc is the line printer control program. is the line printer control program.

35. c. traceroute traceroute. tracert tracert is a Windows utility with the same function as is a Windows utility with the same function as traceroute traceroute.

36. The file is /etc/profile. /etc/profile.

37. b. The The .forward .forward file is placed in the home directory containing a single line with the target email address. file is placed in the home directory containing a single line with the target email address.

38. d. Zero exit values usually indicate success. Zero exit values usually indicate success.

39. b. Instead of using Instead of using set set, the command should have been:#exportmyvar="World"

This gives the myvar myvar variable to the new sh.e.l.l. variable to the new sh.e.l.l.

40. b. The primary group that The primary group that adamh adamh belongs to is group 1000. belongs to is group 1000.

Chapter27.Exam 102 Highlighter"s Index

Sh.e.l.ls, Scripting, and Data Management Objective 105.1: Customize and Use the Sh.e.l.l Environment A sh.e.l.l presents an interactive Textual User Interface, an operating environment, a facility for launching programs, and a programming language.

Sh.e.l.ls can generally be divided into those derived from the Bourne sh.e.l.l, sh sh (including (including bash bash), and the C-sh.e.l.ls, such as tcsh tcsh.

Sh.e.l.ls are distinct from the kernel and run as user programs.

Sh.e.l.ls can be customized by manipulating variables.

Sh.e.l.ls use configuration files at startup.

Sh.e.l.ls pa.s.s environment variables to child processes, including other sh.e.l.ls.

Bash bash is a descendant of is a descendant of sh sh.

Sh.e.l.l variables are known only to the local sh.e.l.l and are not pa.s.sed on to other processes.

Environment variables are pa.s.sed on to other processes.

A sh.e.l.l variable is made an environment variable when it is exported exported.

This sets a sh.e.l.l variable:#PI=3.14 This turns it into an environment variable:#exportPI This definition does both at the same time:#exportPI=3.14 Sh.e.l.l aliases conveniently create new commands or modify existing commands:#aliasmore="less"

Functions are defined for and called in scripts. This line creates a function named lsps lsps:#lsps(){ls-l;ps;} bash configuration files control the sh.e.l.l"s behavior. configuration files control the sh.e.l.l"s behavior. Table13-1 Table13-1 contains a list of these files. contains a list of these files.

Objective 105.2: Customize or Write Simple Scripts Scripts are executable text files containing commands.

Scripts must have appropriate execution bits set in the file mode.

Scripts may define the command interpreter using the syntax #!/bin/bash #!/bin/bash on the first line. on the first line.

Environment A script that starts using #!/bin/bash #!/bin/bash operates in a new invocation of the sh.e.l.l. This sh.e.l.l first executes standard system and user startup scripts. It also inherits exported variables from the parent sh.e.l.l. operates in a new invocation of the sh.e.l.l. This sh.e.l.l first executes standard system and user startup scripts. It also inherits exported variables from the parent sh.e.l.l.

Like binary programs, scripts can offer a return value after execution.

Scripts use file tests to examine and check for specific information on files.

Scripts can use command subst.i.tution command subst.i.tution to utilize the result of an external command. to utilize the result of an external command.

Scripts often send email to notify administrators of errors or status.

Refer to Chapter13 Chapter13 for details on for details on bash bash commands. commands.

Objective 105.3: SQL Data Management Common MySQL datatypes are integer, float, boolean, date, timestamp, datetime, char, varchar, blob, and text.

The SQL syntax for creating a table with one varchar column and one auto-increment integer column (which is also the primary key) is:CREATETABLEtest(idINTEGERUNSIGNEDNOTNULLAUTO_INCREMENT, column1varchar(255),PRIMARYKEY(id)); INSERT is used to insert data into a table, UPDATE is used to modify a data value in an existing table row, and SELECT is used to display values from a table.

ALTER TABLE is used to add/remove columns to a table, or modify a datatype.

A LEFT JOIN is used when we want to display items from two or more tables connected by a relationship, where each item present in the left table will display in the results, even if there is not a match with the other table being joined.

The X Window System Objective 106.1: Install and Configure X11 X.Org is the most popular X Windows implementation on Linux, replacing XFree86.

Window managers handle the functions of creating and managing windows and things such as minimization, maximization, and screen placement.

Desktop environments are collections of common desktop programs that work together to create a unified desktop experience. These will include applications such as window managers, file managers, launch bars, screensavers, and session managers. The two most common desktop environments are Gnome and KDE.

The main configuration file for X.Org is /etc/X11/xorg.conf /etc/X11/xorg.conf.

X Windows can be configured to either read fonts from a local directory or access a font server, such as xfs xfs, running either on the local machine or on another machine on the network.

Objective 106.2: Set Up a Display Manager Display managers are GUI programs that handle the user login process. They are most often invoked when a Linux system enters runlevel 5. Common display managers are xdm xdm, gdm gdm, and kdm kdm. They can all be configured to support remote graphical logins from other terminals through the XDMCP protocol.

Objective 106.3: Accessibility Many applications exist to a.s.sist with accessibility in Linux, including Emacspeak, Orca, and BLINUX. In addition to these separate applications, most desktop environments support a.s.sistive technologies such as StickyKeys, MouseKeys, and RepeatKeys. On-screen keyboards are also a commonly used a.s.sistive technology.

Administrative Tasks Objective 107.1: Manage User and Group Accounts and Related System Files pa.s.swd and group User account information is stored in /etc/pa.s.swd /etc/pa.s.swd.

Each line in /etc/pa.s.swd /etc/pa.s.swd contains a username, pa.s.sword, UID, GID, user"s name, home directory, and default sh.e.l.l. contains a username, pa.s.sword, UID, GID, user"s name, home directory, and default sh.e.l.l.

Group information is stored in /etc/group /etc/group.

Each line in /etc/group /etc/group contains a group name, group pa.s.sword, GID, and group member list. contains a group name, group pa.s.sword, GID, and group member list.

pa.s.swd and and group group are world-readable. are world-readable.

Shadow files To prevent users from obtaining encrypted pa.s.swords from pa.s.swd pa.s.swd and and group group, shadow files are implemented.

Encrypted pa.s.swords are moved to a new file, which is readable only by root root.

The shadow file for /etc/pa.s.swd /etc/pa.s.swd is is /etc/shadow /etc/shadow.

The shadow file for /etc/group /etc/group is is /etc/gshadow /etc/gshadow.

User and group management commands The following commands are commonly used for manual user and group management: useradd user user Create the account user user.

usermod user user Modify the user user account. account.

userdel user user Delete the user user account. account.

groupadd group group Add group group.

groupmod group group Modify the parameters of group group.

groupdel group group Delete group group.

pa.s.swd username username Interactively set the pa.s.sword for username username.

chage user Modify pa.s.sword aging and expiration settings for user user.

Objective 107.2: Automate System Administration Tasks by Scheduling Jobs Both cron cron and and at at can be used to schedule jobs in the future. can be used to schedule jobs in the future.

Scheduled jobs can be any executable program or script.

Using cron The cron cron facility consists of facility consists of crond crond, the cron cron daemon, and daemon, and crontab crontab files containing job-scheduling information. files containing job-scheduling information.

cron is intended for the execution of commands on a periodic basis. is intended for the execution of commands on a periodic basis.

crond examines all examines all crontab crontab files every minute. files every minute.

Each system user has access to cron cron through a personal through a personal crontab crontab file. file.

The crontab crontab command allows the command allows the crontab crontab file to be viewed and, with the file to be viewed and, with the e e option, edited. option, edited.

Entries in the crontab crontab file are in the form of: file are in the form of:minutehourdaymonthdayofweekcommand Asterisks in any of the time fields match all possible values.

In addition to personal crontab crontab files, the system has its own files, the system has its own crontab crontab files in files in /etc/crontab /etc/crontab, as well as files in /etc/cron.d /etc/cron.d.

Using at The at at facility, shown here, is for setting up one-time future command execution: facility, shown here, is for setting up one-time future command execution:at time timeEnter an interactive session with at at, where commands may be entered. time time is of the form is of the form hh:mm hh:mm, midnight midnight, noon noon, and so on.

The atd atd daemon must be running in order for daemon must be running in order for at at commands to be processed. commands to be processed.

User access Access to cron cron can be controlled using lists of users in can be controlled using lists of users in cron.allow cron.allow and and cron.deny cron.deny.

Access to at at can be controlled using lists of users in can be controlled using lists of users in at.allow at.allow and and at.deny at.deny.

Objective 107.3: Localization and Internationalization The suite of programs that comes with the Network Time Protocol (NTP) allow you to keep your system and hardware clocks in sync with accurate time servers over the Internet.

ntpd q will update a system clock against an NTP server and then exit. will update a system clock against an NTP server and then exit.

Hardware clocks are configured to reflect either local time or Universal Coordinated Time (UTC) plus a time zone offset. The command hwclock hwclock can be used to manipulate a hardware clock from within Linux. can be used to manipulate a hardware clock from within Linux.

© 2024 www.topnovel.cc