43
Linux+ Guide to Linux Certification, Second Edition Chapter 11 Common Administrative Tasks

Linux+ Guide to Linux Certification, Second Edition

  • Upload
    marge

  • View
    50

  • Download
    3

Embed Size (px)

DESCRIPTION

Linux+ Guide to Linux Certification, Second Edition. Chapter 11 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 - PowerPoint PPT Presentation

Citation preview

Page 1: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, Second Edition

Chapter 11Common Administrative

Tasks

Page 2: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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 using command-line and graphical utilities

Page 3: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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– File, set of files, output of a command

• lp command: Sends a print job to a printer

Page 4: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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

• Print queue: Directory holding print jobs waiting to be printed– Typically /var/spool/cups

Page 5: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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

Page 6: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 6

Printer Administration: The Common UNIX Printing System (continued)

• lpstat command: With –t (total) option, lists all printers and their status

• accept, reject, enable, and disable commands: Manipulate status of a printer– For enable, must specify full path enable command

(/usr/bin/enable)

Page 7: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 7

Printer Administration: The Common UNIX Printing System (continued)

Figure 11-1: The print process

Page 8: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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

• Users can set own default printer – Add to .lpoptions file in home directory

Page 9: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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

• lpadmin command: Perform printer administration– e.g., restrict who can print to specific printers

Page 10: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 10

Managing Print Jobs (continued)

Table 11-1: Common options to the lp command

Page 11: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 11

Managing Print Jobs (continued)

Table 11-2: Common options to the lpstat command

Page 12: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 12

The LPD Printing System

• Line Printer Daemon (LPD): Printing system used on older Linux systems

• lpr command: Create print jobs in print queue

• lpc command: View status of printers

• lpq command: View print jobs in print queue

• lprm command: Remove print jobs

Page 13: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 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 configure printers– e.g., Add new printers– Configures queue, not printer

Page 14: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 14

Configuring Printers (continued)

Figure 11-2: The Printer Configuration tool

Page 15: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 15

Configuring Printers (continued)

Figure 11-3: Specifying the name of a new printer

Page 16: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 16

Configuring Printers (continued)

Figure 11-5: Different queue types available for a new printer

Page 17: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 17

Configuring Printers (continued)

• For local printers, must choose printer port – Such as /dev/lp0

• For remote printers, specify name or IP address of remote server, printer name, or printer port

• Enable sharing as needed– CUPS can automatically search for other shared

CUPS printers • Allow remote computers to print using the LPD

protocol

Page 18: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 18

Configuring Printers (continued)

Figure 11-6: Selecting the printer model for a new printer

Page 19: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 19

Configuring Printers (continued)

Figure 11-7: Completing the creation of a new printer

Page 20: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 20

Configuring Printers (continued)

Figure 11-8: View a configured printer

Page 21: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 21

Configuring Printers (continued)

Figure 11-9: Sharing a printer to network users

Page 22: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 22

Configuring Printers (continued)

Figure 11-10: Specifying shared printer options

Page 23: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 23

Log File Administration

• Log file: File containing system information

• /var/log: Contains most log files– Many programs store log files in subdirectories

Page 24: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 24

Log File Administration (continued)

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

Page 25: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 25

The System Log Daemon

• System log daemon (syslogd): Logs system events– Uses /etc/syslog.conf file

• Entries indicate what information to write to what log file

Page 26: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 26

The System Log Daemon (continued)

• Facility: Area of system that information is gathered from

• Priority: Importance of system information

Page 27: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 27

The System Log Daemon (continued)

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

Page 28: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 28

The System Log Daemon (continued)

Table 11-5: Priorities used by the log daemon

Page 29: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 29

Managing Log Files

• Log files can take up unnecessary space– Clear contents occasionally

• Print copy for records

• Use > redirection symbol

• Do not remove log files – Permissions and ownership will be removed

Page 30: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 30

Managing Log Files (continued)

• logrotate command: Back up and clear log files

• /etc/logrotate.conf: Used by logrotate utility – Specifies rotation parameters for log files

• Log files compressed after rotation

Page 31: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 31

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

• Previously stored password information– /etc/shadow: Encrypted password information

• pwconv command: Convert system to use an /etc/shadow file for encrypted password storage

Page 32: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 32

Administering Users and Groups (continued)

• pwunconv command: Revert back to using an /etc/passwd file only

• User Identifier (UID): Unique user ID for a user

• Group Identifier (GID): Primary group ID for each user

• Primary group: Group owner for all files created by a user– Specified in /etc/passwd file

Page 33: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 33

Administering Users and Groups (continued)

• General Electric Comprehensive Operating System (GECOS): Field in /etc/passwd file containing user account description

• Root user usually listed at top of /etc/passwd file

• /etc/shadow: Password field contains encrypted password

• /etc/passwd: Password field contains an x (not used)

Page 34: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 34

Administering Users and Groups (continued)

• Passwords often set to expire at certain intervals– Intervals specified in /etc/shadow

• /etc/group file: Lists all groups and their members– Allows users to belong to multiple groups– Password field usually contains an x

Page 35: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 35

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 36: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 36

Creating User Accounts (continued)

• Skeleton directory: Contains files to copy to new users’ home directories– Usually /etc/skel– Mostly environment files

• 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 37: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 37

Creating User Accounts (continued)

Table 11-6: Common options to the useradd command

Page 38: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 38

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

• chsh command: Change a valid shell to an invalid shell

Page 39: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 39

Modifying User Accounts (continued)

Table 11-7: Common options to the usermod command

Page 40: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 40

Deleting User Accounts

• userdel command: Remove user accounts

• 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 41: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 41

Managing Groups

• 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 42: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 42

Managing Groups (continued)

• groups command: List groups that a 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 43: Linux+ Guide to Linux Certification, Second Edition

Linux+ Guide to Linux Certification, 2e 43

Managing Groups (continued)

Figure 11-11: Configure users and groups with a desktop environment