Transcript
Page 1: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, Third Edition

Chapter 10Common Administrative

Tasks

Page 2: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 2

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

Page 3: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 3

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

Page 4: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 4

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

Page 5: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 5

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.

Page 6: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 6

Printer Administration: The Common UNIX Printing System (continued)

Figure 10-1: The print process

Page 7: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 7

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

Page 8: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 8

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

Page 9: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 9

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

Page 10: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 10

Managing Print Jobs (continued)

Table 10-1: Common options to the lp command

Page 11: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 11

Managing Print Jobs (continued)

Table 10-2: Common options to the lpstat command

Page 12: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 12

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

Page 13: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 13

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

Page 14: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 14

Configuring Printers (continued)

Figure 10-2: The Printer Configuration tool

Page 15: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 15

Configuring Printers (continued)

Figure 10-3: Specifying the printer device

Page 16: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 16

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

Page 17: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 17

Configuring Printers (continued)

Figure 10-4: Selecting the printer manufacturer

Page 18: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 18

Configuring Printers (continued)

Figure 10-5: Selecting the printer model

Page 19: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 19

Configuring Printers (continued)

Figure 10-6: Completing the creation of a new printer

Page 20: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 20

Configuring Printers (continued)

Figure 10-7: Viewing installed printers

Page 21: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 21

Configuring Printers (continued)

Figure 10-8: Modifying printer properties

Page 22: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 22

Configuring Printers (continued)

Figure 10-9: The Policies section of printer properties

Page 23: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 23

Configuring Printers (continued)

Figure 10-10: The Access control section of printer properties

Page 24: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

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 24

Page 25: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 25

Configuring Printers (continued)

Figure 10-11: Configuring CUPS settings

Page 26: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 26

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

Page 27: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 27

Log File Administration (continued)

Table 10-3: Common Linux log files found in /var/log

Page 28: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 28

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

Page 29: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 29

The System Log Daemon (continued)

Table 10-4: Facilities used by the System Log Daemon

Page 30: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 30

The System Log Daemon (continued)

Table 10-5: Priorities used by the log daemon

Page 31: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 31

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

Page 32: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 32

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

Page 33: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

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 33

Page 34: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

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 34

Page 35: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 35

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

Page 36: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 36

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

Page 37: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 37

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

Page 38: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 38

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

Page 39: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 39

Creating User Accounts (continued)

Table 10-6: Common options to the useradd command

Page 40: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 40

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

Page 41: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 41

Modifying User Accounts (continued)

Table 10-7: Common options to the usermod command

Page 42: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 42

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

Page 43: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 43

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

Page 44: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 44

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

Page 45: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 45

Managing Groups (continued)

Figure 10-13: Configuring users and groups within a desktop environment

Page 46: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 46

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

Page 47: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

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 47

Page 48: Linux+ Guide to Linux Certification, Third Edition Chapter 10 Common Administrative Tasks

Linux+ Guide to Linux Certification, 3e 48

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


Recommended