Title: Linux Guide to Linux Certification, Third Edition
1Linux Guide to Linux Certification, Third Edition
- Chapter 10
- Common Administrative Tasks
2Objectives
- 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
3Printer 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
4Printer Administration The Common UNIX Printing
System (continued)
- cups daemon (cupsd) responsible for printing in
CUPS printing system - Print job ID print jobs unique identifier
- Assigned by cupsd
- Print queue directory holding print jobs waiting
to be printed - Typically /var/spool/cups
5Printer 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.
6Printer Administration The Common UNIX Printing
System (continued)
Figure 10-1 The print process
7Printer 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
8Managing 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
9Managing 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
10Managing Print Jobs (continued)
Table 10-1 Common options to the lp command
11Managing Print Jobs (continued)
Table 10-2 Common options to the lpstat command
12The 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
13Configuring Printers
- /etc/cups/cupsd.conf contains cupsd settings
- /etc/cups/printers.conf contains each printers
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
14Configuring Printers (continued)
Figure 10-2 The Printer Configuration tool
15Configuring Printers (continued)
Figure 10-3 Specifying the printer device
16Configuring 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
17Configuring Printers (continued)
Figure 10-4 Selecting the printer manufacturer
18Configuring Printers (continued)
Figure 10-5 Selecting the printer model
19Configuring Printers (continued)
Figure 10-6 Completing the creation of a new
printer
20Configuring Printers (continued)
Figure 10-7 Viewing installed printers
21Configuring Printers (continued)
Figure 10-8 Modifying printer properties
22Configuring Printers (continued)
Figure 10-9 The Policies section of printer
properties
23Configuring Printers (continued)
Figure 10-10 The Access control section of
printer properties
24Configuring 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
25Configuring Printers (continued)
Figure 10-11 Configuring CUPS settings
26Log 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
27Log File Administration (continued)
Table 10-3 Common Linux log files found in
/var/log
28The 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
29The System Log Daemon (continued)
Table 10-4 Facilities used by the System Log
Daemon
30The System Log Daemon (continued)
Table 10-5 Priorities used by the log daemon
31Managing Log Files
- Log files can take up unnecessary space
- Clear contents occasionally
- Print copy for records
- Use gt redirection symbol to clear log file
- Use cron daemon for repetitive clearing
- Do not remove log files
- Permissions and ownership will be removed
32Managing 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
33Administering Users and Groups
- Authentication verify users 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
34Administering 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
35Administering 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
36Administering 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
37Creating 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
38Creating 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 users password
- If no arguments, sets current users password
- User accounts must have password set to log on
- Root user can change any users password
39Creating User Accounts (continued)
Table 10-6 Common options to the useradd command
40Modifying 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
41Modifying User Accounts (continued)
Table 10-7 Common options to the usermod command
42Deleting 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
43Managing 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
44Managing 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 users primary
group - Graphical utilities exist to create, modify, and
delete user and group accounts
45Managing Groups (continued)
Figure 10-13 Configuring users and groups within
a desktop environment
46Summary
- 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
47Summary (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
48Summary (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