738c2b00150bf4d2044e9677473aa4f6.ppt
- Количество слайдов: 48
LINUX+ GUIDE TO LINUX CERTIFICATION, THIRD EDITION Chapter 10 Common Administrative Tasks
Objectives Set up, manage, and print to printers on a Linux system Understand the purpose of log files and how they are administered Create, modify, manage, and delete user and group accounts Linux+ Guide to Linux Certification, 3 e 2
Printer Administration: The Common UNIX Printing System Common Unix Printing System (CUPS): most common printing system used on Linux Print job: set of information sent to a printer at the same time Can consist of a file, a set of files, or the output of a command lp command: sends a print job to a printer Linux+ Guide to Linux Certification, 3 e 3
Printer Administration: The Common UNIX Printing System (continued) cups daemon (cupsd): responsible for printing in CUPS printing system Print job ID: print job’s unique identifier Assigned by cupsd Print queue: directory holding print jobs waiting to be printed Typically /var/spool/cups Linux+ Guide to Linux Certification, 3 e 4
Printer Administration: The Common UNIX Printing System (continued) Printer can accept or reject request to print If rejected, CUPS gives an error message Spooling or queuing: accepting print jobs into a print queue Printing: sending print jobs from print queue to a printer Occurs if the printer is enabled, cupsd removes copy of print job from the print queue. Linux+ Guide to Linux Certification, 3 e 5
Printer Administration: The Common UNIX Printing System (continued) Figure 10 -1: The print process Linux+ Guide to Linux Certification, 3 e 6
Printer Administration: The Common UNIX Printing System (continued) lpstat command: with –t (total) option, lists all printers and their status cupsaccept, cupsreject, cupsenable, and cupsdisable commands: manipulate status of a printer -r option: used to specify reason for cupsdisable and cupsreject commands Linux+ Guide to Linux Certification, 3 e 7
Managing Print Jobs lp –d command: print to a specified printer If –d option omitted, prints to default printer lpoptions –d command: set default printer Each user can set his own default printer Add name of the default printer to. lpoptions file in home directory Use PRINTER or LPDEST variable Linux+ Guide to Linux Certification, 3 e 8
Managing Print Jobs (continued) lp command accepts information from stdin lpstat command can list print jobs in queue for a printer cancel command: remove print jobs from print queue Receives print job IDs as arguments -u option: remove all the jobs sent by specified user lpadmin command: perform printer administration e. g. , restrict specific user access to specific printers Linux+ Guide to Linux Certification, 3 e 9
Managing Print Jobs (continued) Table 10 -1: Common options to the lp command Linux+ Guide to Linux Certification, 3 e 10
Managing Print Jobs (continued) Table 10 -2: Common options to the lpstat command Linux+ Guide to Linux Certification, 3 e 11
The LPD Printing System Line Printer Daemon (LPD): printing system used on older Linux systems lpr command: send documents to a print queue lpc command: view status of printers lpq command: view print jobs in print queue lprm command: remove print jobs CUPS contains versions of the lpr, lpc, lpq, and lprm commands Linux+ Guide to Linux Certification, 3 e 12
Configuring Printers /etc/cupsd. conf: contains cupsd settings /etc/cups/printers. conf: contains each printer’s configuration information Printer Configuration tool: used to edit printer and cupsd setting files and thus configure printers Activated using the system-config-printer command in a desktop environment e. g. , add new printers Linux+ Guide to Linux Certification, 3 e 13
Configuring Printers (continued) Figure 10 -2: The Printer Configuration tool Linux+ Guide to Linux Certification, 3 e 14
Configuring Printers (continued) Figure 10 -3: Specifying the printer device Linux+ Guide to Linux Certification, 3 e 15
Configuring Printers (continued) For local printers that do not support Pn. P, must specify the Uniform Resource Identifier (URI) for the device Within Printer Configuration tool you can: Give a printer a name to identify it within programs and commands Specify printer location and description Modify printer properties Manage the status of the printer, share it using IPP, choose an error action, and configure banner pages Linux+ Guide to Linux Certification, 3 e 16
Configuring Printers (continued) Figure 10 -4: Selecting the printer manufacturer Linux+ Guide to Linux Certification, 3 e 17
Configuring Printers (continued) Figure 10 -5: Selecting the printer model Linux+ Guide to Linux Certification, 3 e 18
Configuring Printers (continued) Figure 10 -6: Completing the creation of a new printer Linux+ Guide to Linux Certification, 3 e 19
Configuring Printers (continued) Figure 10 -7: Viewing installed printers Linux+ Guide to Linux Certification, 3 e 20
Configuring Printers (continued) Figure 10 -8: Modifying printer properties Linux+ Guide to Linux Certification, 3 e 21
Configuring Printers (continued) Figure 10 -9: The Policies section of printer properties Linux+ Guide to Linux Certification, 3 e 22
Configuring Printers (continued) Figure 10 -10: The Access control section of printer properties Linux+ Guide to Linux Certification, 3 e 23
Configuring Printers (continued) To apply standard printer properties to several printers on a system, create printer class Apply the properties to the printer class Printer Configuration tool allows configuration of the properties of CUPS daemon Add shared network printers Share printers on the system Remotely create and manage printers Linux+ Guide to Linux Certification, 3 e 24
Configuring Printers (continued) Figure 10 -11: Configuring CUPS settings Linux+ Guide to Linux Certification, 3 e 25
Log File Administration Log file: file containing system information Typically recorded during daemon activity Information includes error messages /var/log: contains most log files Many programs store log files in subdirectories Linux+ Guide to Linux Certification, 3 e 26
Log File Administration (continued) Table 10 -3: Common Linux log files found in /var/log Linux+ Guide to Linux Certification, 3 e 27
The System Log Daemon System log daemon (syslogd): central handling of logging system events Creates /dev/log socket for system processes to write to Writes to appropriate log file using /etc/rsyslog. conf file ○ Entries indicate facility and priority Facility: area of system that information is gathered from Priority: importance of system information Linux+ Guide to Linux Certification, 3 e 28
The System Log Daemon (continued) Table 10 -4: Facilities used by the System Log Daemon Linux+ Guide to Linux Certification, 3 e 29
The System Log Daemon (continued) Table 10 -5: Priorities used by the log daemon Linux+ Guide to Linux Certification, 3 e 30
Managing Log Files Log files can take up unnecessary space Clear contents occasionally ○ Print copy for records ○ Use > redirection symbol to clear log file ○ Use cron daemon for repetitive clearing Do not remove log files Permissions and ownership will be removed Linux+ Guide to Linux Certification, 3 e 31
Managing Log Files (continued) logrotate command: back up and clear log files Compress old log files and save under new name /etc/logrotate. conf: used by logrotate utility Specifies rotation parameters for log files Linux+ Guide to Linux Certification, 3 e 32
Administering Users and Groups Authentication: verify user’s identity Compare username and password to system database Database containing user account information typically consists of two files /etc/passwd: user account information /etc/shadow: encrypted password and expiration information pwconv command: convert system to use an /etc/shadow file for encrypted password storage Linux+ Guide to Linux Certification, 3 e 33
Administering Users and Groups (continued) pwunconv command: revert back to using an /etc/passwd file only User Identifier (UID): unique user ID for each user Group Identifier (GID): primary group ID for each user Primary group: group owner for all files created by a user General Electric Comprehensive Operating System (GECOS): text description of the user Typically left blank Linux+ Guide to Linux Certification, 3 e 34
Administering Users and Groups (continued) Root user usually listed at top of /etc/passwd file Next are listed system daemons Password field differs in the two files: /etc/shadow: contains encrypted password /etc/passwd: contains an x character lastchange: date of most recent password change Number represents number of days since January 1, 1970 Linux+ Guide to Linux Certification, 3 e 35
Administering Users and Groups (continued) Passwords often set to expire at certain intervals Intervals specified in /etc/shadow ○ Minimum number of days before changing password ○ Maximum number of days to use password ○ Number of days before password expiration in which user is warned to change password /etc/group file: Lists all groups and their members Allows users to belong to multiple groups Password field usually contains an x Linux+ Guide to Linux Certification, 3 e 36
Creating User Accounts useradd command: add new user accounts Most new user information comes from two files /etc/login. defs ○ E-mail location, password expiration, minimum password length, range of UIDs and GIDs /etc/default/useradd ○ Default primary group, home directory location, password expiration info, shell, skeleton directory Linux+ Guide to Linux Certification, 3 e 37
Creating User Accounts (continued) Skeleton directory: contains environment files to copy to new users’ home directories Usually /etc/skel Override default parameters by specifying options to useradd command passwd command: set a user’s password If no arguments, sets current user’s password User accounts must have password set to log on Root user can change any user’s password Linux+ Guide to Linux Certification, 3 e 38
Creating User Accounts (continued) Table 10 -6: Common options to the useradd command Linux+ Guide to Linux Certification, 3 e 39
Modifying User Accounts usermod command: modify user account information chage command: modify password expiration information Locking an account: make an account temporarily unusable Alter password information Use –l or –L options of passwd command chsh command: change a valid shell to an invalid shell Linux+ Guide to Linux Certification, 3 e 40
Modifying User Accounts (continued) Table 10 -7: Common options to the usermod command Linux+ Guide to Linux Certification, 3 e 41
Deleting User Accounts userdel command: remove user accounts Specify user name as argument When an account is deleted, files previously owned by the user become owned by a number representing UID of deleted user Next user with that UID will own the files Linux+ Guide to Linux Certification, 3 e 42
Managing Groups Can add groups by editing /etc/group file groupadd command: add a group to the system groupmod command: modify GID name of a group on the system groupdel command: remove a group from the system Linux+ Guide to Linux Certification, 3 e 43
Managing Groups (continued) groups command: list groups that user belongs to id command: list GIDs of groups that a user belongs to newgrp command: temporarily change user’s primary group Graphical utilities exist to create, modify, and delete user and group accounts Linux+ Guide to Linux Certification, 3 e 44
Managing Groups (continued) Figure 10 -13: Configuring users and groups within a desktop environment Linux+ Guide to Linux Certification, 3 e 45
Summary Print jobs are spooled to a print queue before being printed to a printer You can configure spooling or printing by using the cupsaccept, cupsreject, cupsenable, and cupsdisable commands Print jobs are created using lp, can be viewed in the queue using lpstat, and are removed from the queue using cancel Linux+ Guide to Linux Certification, 3 e 46
Summary (continued) Create local and remote printers using Printer Configuration tool or by modifying /etc/cups/printers. conf Most log files in Linux are stored in /var/log System events are typically logged to files by the System Log Daemon Log files should be cleared or rotated over time to save disk space User and group account information is typically in /etc/passwd, /etc/shadow, and /etc/group Linux+ Guide to Linux Certification, 3 e 47
Summary (continued) Use the useradd command to create users and the groupadd command to create groups All users must have a valid password before logging in to a Linux system Users can be modified with usermod, chage, chfn, chsh, and passwd commands, and groups can be modified using groupmod command The userdel and groupdel commands remove users and groups from the system, respectively Linux+ Guide to Linux Certification, 3 e 48