480 likes | 648 Views
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.
E N D
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, 3e
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, 3e
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, 3e
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, 3e
Printer Administration: The Common UNIX Printing System (continued) Figure 10-1: The print process Linux+ Guide to Linux Certification, 3e
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, 3e
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, 3e
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, 3e
Managing Print Jobs (continued) Table 10-1: Common options to the lp command Linux+ Guide to Linux Certification, 3e
Managing Print Jobs (continued) Table 10-2: Common options to the lpstatcommand Linux+ Guide to Linux Certification, 3e
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, 3e
Configuring Printers • /etc/cups/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, 3e
Configuring Printers (continued) Figure 10-2: The Printer Configuration tool Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-3: Specifying the printer device Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) • For local printers that do not support PnP, 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, 3e
Configuring Printers (continued) Figure 10-4: Selecting the printer manufacturer Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-5: Selecting the printer model Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-6: Completing the creation of a new printer Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-7: Viewing installed printers Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-8: Modifying printer properties Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-9: The Policies section of printer properties Linux+ Guide to Linux Certification, 3e
Configuring Printers (continued) Figure 10-10: The Access control section of printer properties Linux+ Guide to Linux Certification, 3e
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, 3e
Configuring Printers (continued) Figure 10-11: Configuring CUPS settings Linux+ Guide to Linux Certification, 3e
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, 3e
Log File Administration (continued) Table 10-3: Common Linux log files found in /var/log Linux+ Guide to Linux Certification, 3e
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, 3e
The System Log Daemon (continued) Table 10-4: Facilities used by the System Log Daemon Linux+ Guide to Linux Certification, 3e
The System Log Daemon (continued) Table 10-5: Priorities used by the log daemon Linux+ Guide to Linux Certification, 3e
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, 3e
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, 3e
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, 3e
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, 3e
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, 3e
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, 3e
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, 3e
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, 3e
Creating User Accounts (continued) Table 10-6: Common options to the useradd command Linux+ Guide to Linux Certification, 3e
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, 3e
Modifying User Accounts (continued) Table 10-7: Common options to the usermod command Linux+ Guide to Linux Certification, 3e
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, 3e
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, 3e
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, 3e
Managing Groups (continued) Figure 10-13: Configuring users and groups within a desktop environment Linux+ Guide to Linux Certification, 3e
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, 3e
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, 3e
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, 3e