0% found this document useful (0 votes)
31 views

Eckert5e ch10

This document discusses common administrative tasks in Linux, focusing on printer administration and configuration. It describes how the Common UNIX Printing System (CUPS) manages printers and print jobs by assigning unique IDs, queuing jobs, and sending them to printers. Instructions are provided for configuring and managing printers using CUPS and its web interface, adding printer details and sharing them on the network. Additionally, legacy printing systems like LPD are mentioned.

Uploaded by

Stephen Efange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Eckert5e ch10

This document discusses common administrative tasks in Linux, focusing on printer administration and configuration. It describes how the Common UNIX Printing System (CUPS) manages printers and print jobs by assigning unique IDs, queuing jobs, and sending them to printers. Instructions are provided for configuring and managing printers using CUPS and its web interface, adding printer details and sharing them on the network. Additionally, legacy printing systems like LPD are mentioned.

Uploaded by

Stephen Efange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 40

Chapter 10

Common Administrative Tasks

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. M
ay not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Objectives
• After completing this chapter, you will be able to:
• 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

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Printer Administration
• Being able to print is commonly required by most users on a
Linux system
• Printing log files and system configuration information is a good practice in
case of system failure
• A firm understanding of how to set up, manage, and print to printers is
vital to Linux servers

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Common UNIX Printing System (1 of 5)
• 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, several files, or the output of a command
• The lp command: sends a print job to a printer

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Common UNIX Printing System (2 of 5)
• CUPS daemon (cupsd): assigns the print job a unique print job ID
and places a copy of the print job into a temporary directory on
the filesystem
• Print job ID: unique identifier assigned by cupsd
• Print queue: directory holding print jobs waiting to be printed

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Common UNIX Printing System (3 of 5)
• Printer can accept or reject request to print
• If rejected, CUPS displays an error message
• Spooling or queuing: accepting print jobs into a print queue
• If printer is enabled and ready to accept print jobs, the CUPS
daemon sends the print job from the print queue to the printer
• The copy of the print job is removed from the print queue
• If printer is disabled, print job remains in the print queue

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Common UNIX Printing System (4 of 5)

Figure 10-1: The print process

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The Common UNIX Printing System (5 of 5)
• The lpstat command: with –t (total) option, lists all printers and
their status
• The cupsaccept, cupsreject, cupsenable, and cupsdisable
commands: manipulate the status of a printer
• The -r option: used to specify reason for cupsdisable and cupsreject
commands

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Managing Print Jobs (1 of 2)
• The lp command: create a print job
• The lp –d command: specify the destination printer name
• If –d option is omitted, prints to default printer
• The cancel command: remove print jobs from print queue
• The -u option: remove all the jobs sent by specified user
• The lpadmin command: restrict specific user access to specific
printers

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Managing Print Jobs (2 of 2)
Table 10-2: Common options
to the lpstat command
Option Description
-a Displays a list of printers that are accepting print jobs
-d Displays the default destination printer
-o printername Displays the print jobs in the print queue for printername
only
-p Displays a list of printers that are enabled
-r Shows whether the CUPS daemon (scheduler) is running
-s Shows printer and printer status information
-t Shows all information about printers and their print jobs

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
The LPD Printing System
• Line Printer Daemon (LPD): used on legacy Linux systems
• The lpr command: send documents to a print queue
• The lpc command: view status of printers
• The lpq command: view print jobs in print queue
• The lprm command: remove print jobs
• CUPS contains versions of the lpr, lpc, lpq, and lprm commands

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (1 of 9)
• /etc/cups/cupsd.conf: contains cupsd settings
• /etc/cups/printers.conf: contains each printer’s configuration
information
• Be default, the CUPS daemon detects locally connected and
network-shared printers
• Automatically adds an entry for them in the printers.conf file
• For any printers that the CUPS daemon does not detect and configure,
you must provide the necessary information

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (2 of 9)
• On Fedora Linux, the Printers tool within GNOME desktop can be
used to create new printers and manage them
• Access the Printers tool by navigating to the Activities menu, Show
Applications, Settings, Printers
• Most comprehensive way to create and manage CUPS printers is
by using the CUPS Web administration tool
• Use a Web browser on TCP port 631

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (3 of 9)

Figure 10-2: The Printers tool

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (4 of 9)

Figure 10-3: The CUPS Web administration tool

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (5 of 9)
• Create a new printer using CUPS Web administration tool
• Select the Administration tab, click Add Printer, and log in using the root
username and password
• Select the type of printer

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (6 of 9)
• After selecting printer type, you will be prompted to specify:
• Printer name
• Description
• Manufacturer and model
• Default printer options
• Whether to share the printer using IPP
• After creating a printer, other options are available on the
Administration tab to configure and manage the CUPS printing
service

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (7 of 9)

Figure 10-5: CUPS administration options

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (8 of 9)
• CUPS allows you to configure collections of printers that can be
used as a single unit
• Collections called printer classes
• Often used in larger organizations, where multiple printers are stored in a
print room
• To create a printer class, select the Add Class button

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Configuring Printers (9 of 9)
• Manage Job allows you to view, modify, and delete print jobs that
have submitted to the queue
• Regular users can use the CUPS Web administration tool and select the
Jobs tab to manage their own jobs
• The Server section allows you to edit the CUPS configuration file,
access log files, and perform advanced functions

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Log File Administration
• Log file: file containing system information
• Typically recorded during daemon activity
• Information includes error messages
• /var/log directory: contains log files
• Many programs store log files in subdirectories of the /var/log directory
• Most common logging daemons used on Linux systems today
• System Log Daemon (rsyslogd)
• Systemd Journal Daemon (journald)

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Working with the System Log Daemon
• System log daemon (syslogd): the traditional and most common
logging daemon
• Creates /dev/log socket for system processes to write to
• Writes to appropriate log file using /etc/rsyslog.conf file
• Facility: area of system to listen to
• Priority: importance of information

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Working with the Systemd Journal Daemon (1 of 2)
• The Systemd Journal Daemon replaces the System Log Daemon
on Linux distributions that use Systemd
• Similar to System Log Daemon
• Events logged are not controlled by specific rules
• Journald logs all information to a database under the
/var/log/journal directory structure
• Events are tagged with the same facility and priority information as the
rsyslogd daemon

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Working with the Systemd Journal Daemon (2 of 2)
• The journalctl command: use to view events within the journald
database
• Type journalctl and press the Tab key to see a list of areas and criteria
that can be queried
• You can query events related to a specific process or daemon
• Specify the path name to the executable file or PID

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Managing Log Files and the journald Database
(1 of 2)
• Log files can take up unnecessary space
• The journald database is configured to use persistent storage by default
• For systems using Systemd
• Limit the size of the journald database by uncommenting and configuring
the SystemMaxUse line in /etc/systemd/journald.conf
• Prevent key older events from being overwritten
• Create a shell script that executes the appropriate journalctl commands to
either print or save them to a text file

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Managing Log Files and the Journald Database
(2 of 2)
• For log files within the /var/log directory
• Clear contents occasionally
• Use > redirection symbol to clear log file
• Use the logrotate command to back up and clear log files from entries stored in
the /etc/logrotate.conf file and files stored in the /etc/ logrotate.d directory

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Administering Users and Groups (1 of 4)
• 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
• The pwconv command: convert system to use an /etc/shadow file
for encrypted password storage
• The pwunconv command: revert back to using an /etc/passwd file
only
Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Administering Users and Groups (2 of 4)
• 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 user

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Administering Users and Groups (3 of 4)
• Root user is usually listed at top of /etc/passwd file
• Followed by user accounts used by daemons, followed by regular user
accounts
• Password field differs in the two files:
• /etc/shadow: contains encrypted password
• /etc/passwd: contains an x character
• Lastchange field: date of most recent password change
• Number represents number of days since January 1,1970

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Administering Users and Groups (4 of 4)
• Passwords can be set to expire at certain intervals
• Three fields of the /etc/shadow file indicate:
• Min: number of days a user must wait before changing password
• Max: number of days a user can use the same password without changing it
• Warn: number of days before a password would expire that a user is warned to
change his password
• When a password has expired, the user is still allowed to log in to
the system for a certain period of time
• Number of days allowed is represented by the disable1 field in etc/shadow
• /etc/group file: lists all groups and their members

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Creating User Accounts (1 of 2)
• The 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

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Creating User Accounts (2 of 2)
• Skeleton directory: contains environment files to copy to new
users’ home directories
• Usually /etc/skel
• Override default parameters by specifying options to useradd
command
• The passwd command: set a user’s password

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Modifying User Accounts
• The usermod command: modify user account information
• The chage command: modify password expiration information
• Lock an account: temporarily prevent a user from logging in
• The usermod -L command
• The passwd –u username
• The chsh command

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Deleting User Accounts
• The userdel command: delete 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

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Managing Groups (1 of 2)
• Add groups to a system
• Edit the /etc/group file using a text editor
• Use the groupadd command
• Use the -G option to the usermod command to add members to
the group
• The groupmod command: modify GID name of a group on the system
• The groupdel command: remove a group from the system
• The groups command: list groups that a user belongs to
• The id command: list GIDs of groups

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Managing Groups (2 of 2)

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

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Summary (1 of 4)
• 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 command

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Summary (2 of 4)
• Configure printers using the lpadmin command, the CUPS Web
administration tool, or by modifying the /etc/cups/printers.conf file
• Most log files in Linux are stored in /var/log directory
• System events are typically logged to files by the System Log
Daemon or to a database by the Systemd Journal Daemon
• You can use the journalctl command to view the contents of the
journald database

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Summary (3 of 4)
• Log files should be cleared or rotated over time to save disk
space
• User and group account information is typically stored in the
/etc/passwd, /etc/ shadow, and /etc/group files
• 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

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Summary (4 of 4)
• 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

Eckert, Linux+ and LPIC-1 Guide to Linux Certification, 5th Edition. © 2019 Cengage. All Rights Reserved. May
not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.

You might also like