Raspberry Pi OS System Administration with systemd: A Practical Approach

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

The first in a new series exploring the basics of Raspberry Pi Operating System (OS) administration, this volume is a compendium of easy-to-use and essential system administration for the novice user of the Raspberry Pi OS. The overriding idea behind the system administration of a modern, 21st-century Linux system such as the Raspberry Pi OS is the use of systemd to ensure that the Linux kernel works efficiently and effectively to provide the three foundation stones of computer operation and management: computer system concurrency, virtualization, and secure persistence. Exercises are included throughout to reinforce the readers’ learning goals with solutions and example code provided on the accompanying GitHub site. This book is aimed at students and practitioners looking to maximize their use of the Raspberry Pi OS. With plenty of practical examples, projects, and exercises, this volume can also be adopted in a more formal learning environment to supplement and extend the basic knowledge of a Linux operating system.

Author(s): Robert M. Koretsky
Edition: 1
Publisher: Chapman and Hall/CRC
Year: 2023

Language: English
Commentary: Publisher's PDF
Pages: 268
City: Boca Raton, FL
Tags: System Administration; Raspberry Pi; CUPS; Access Control; Raspberry Pi OS; sytemd

Cover
Half Title
Series Information
Title Page
Copyright Page
Dedication
Table of Contents
Series Preface
Volume 1 Preface
Background
How to Read and Use This Book
Routes Through the Book
0 “Quick Start” Into Sysadmin for the Raspberry Pi OS
0.1 Introduction
0.2 File Maintenance Commands and Help On Raspberry Pi OS Command Usage
0.2.1 File and Directory Structure
0.2.2 Viewing the Contents of Files
0.2.3 Creating, Deleting, and Managing Files
0.2.4 Creating, Deleting, and Managing Directories
0.2.5 Obtaining Help With the Man Command
0.2.6 Other Methods of Obtaining Help
0.3 Utility Commands
0.3.1 Examining System Setups
0.4 Printing Commands
0.5 Chapter Summary
1 Basic System Administration
1.0 Objectives, Commands, and Primitives Covered
1.1 Introduction – Icebreaker With Inxi and FileZilla
1.1.1 Inxi
1.1.2 FileZilla
1.2 Webmin Download and Installation
Example 1.1 Webmin Installation On Raspberry Pi OS
1.3 Sshd and System Service Management Using Systemd: Vsftpd
1.3.1 Connecting Via a Secure SHell (SSH) Client Between Raspberry Pi OS Machines
1.3.1.1 Login and Logout Procedures
Example 1.2 Vsftpd
1.4 Systemd Bootup
1.5 File Systems, Connections to Persistent Media, and Adding Disks to Your System
1.5.1 Preliminary Considerations When Adding New Media
1.5.2 Five Quick and Easy Ways to Find Out the Logical Device Names of Disks
1.5.3 Examples of External Disk Or Media Additions
Example 1.3 Using Gparted to Add a USB Flash Drive to the System
Example 1.4 How to Boot From and Run a Raspberry Pi OS System From a USB3-Mounted SSD
Example 1.5 Creating and Managing RAID Arrays Using Mdadm On the Raspberry Pi OS
Example 1.6 RAID1 Using Webmin, Mdadm, and the Gnome Disk Utility (Disks)
1.6 CUPS Printing
1.6.1 Managing CUPS Locally With Systemd
1.6.1.1 Starting CUPS Service Using Systemd
1.6.1.2 Stopping CUPS Service With Systemd
1.6.1.3 Restarting, Enabling, Or Disabling the CUPS Service With Systemd
1.6.1.4 Configuring CUPS as a Persistent Service Using Systemd
1.6.2 Using Web-Based CUPS Administration
1.6.2.1 Using the Web-Based Interface to CUPS Locally
1.6.2.2 LAN Or Web-Based CUPS
1.6.3 Requirements for Using the CUPS Web Browser Interface
1.6.4 Adding a Printer Using the CUPS Web Browser Interface
1.6.5 Troubleshooting Issues With Accessing the CUPS Web Browser Interface
1.6.6 Print Administration Tasks and the Home Tab
1.6.7 Using the Administration Tab
1.6.8 Using the Printers Tab
1.6.9 Other Examples of Web-Based Cups Management
1.6.10 CUPS Print Settings GUI
1.6.11 Starting CUPS Print Settings
1.6.12 Setting Up Printers By Using CUPS Print Settings GUI
1.6.12.1 How to Set Up a New Local Printer
1.6.12.2 Configuring and Managing Printers By Using CUPS Print Settings GUI
1.6.12.3 An Example of How to Modify the Properties of an Existing Configured Printer
Example 1.8 Modifying Printer Properties
1.6.12.4 How to Rename a Printer
1.6.12.5 How to Duplicate a Printer Configuration
1.6.12.6 How to Delete a Printer
1.6.12.7 How to Disable Or Enable a Printer
1.6.12.8 How to Manage Print Jobs for a Specified Printer
1.6.13 Configuring and Managing Printers By Using CUPS On the Command Line
1.6.13.1 CUPS Command-Line Utilities
1.6.13.2 How to Set Up a Printer By Using the Lpadmin Command
1.6.13.3 Setting a Default Printer On Your System
1.6.13.4 How to Set a Default Printer at the Command Line
1.6.13.5 Setting a Default Printer By Specifying the PRINTER Variable
1.6.13.6 Setting a Default Printer By Specifying the LPDEST Variable
1.6.13.7 Setting a Default Printer By Using the Lpoptions Command
1.6.13.8 How to Print to a Specified Printer
1.6.13.9 Printing to a Specified Printer By Using the Lp Command
1.6.13.10 How to Verify the Status of Printers
1.6.13.11 Displaying the Status of Printers
1.6.13.12 How to Print a File to the Default Printer
1.6.13.13 How to Delete a Printer and Remove Printer Access
1.6.13.14 Deleting a Printer
1.7 Other Linux Archiving and Backup Facilities
1.7.1 Cpio
1.7.2 Dd
1.7.3 Rsync
Example 1.9 Extended Python Script Example Using Rsync to Do a “Rotating” Backup
1.8 Repository Management
1.8.1 Searching Repositories With the Apt-Cache Command and Apt-Show
1.8.2 Basic Repository Characteristics
1.8.3 Repository Listing Format in /etc/apt/sources.list
1.8.4 Other Suggested Procedures for Repository Management
1.9 Tasks, Processes, Threads, and Traditional Process Control/Monitoring
1.10 Controlling and Managing CPU Consumption By Processes
1.11 Systemd Journal Log Messages
1.11.1 Journalctl Basics
1.12 Access Control Credentials: Discretionary (DAC), Mandatory (MAC), and Role-Based (RBAC)
1.12.1 Types of Credentials
1.13 Sudo
1.13.1 Alias Specifications and Definition in the Sudoers File
1.13.2 User Specifications in the Sudoers File
1.13.3 Sudo Su -
1.14 Raspberry Pi OS POSIX.1e Access Control Lists (ACLs)
1.14.1 Using Access Control Lists (ACLs) in the Raspberry Pi OS
1.14.2 Raspberry Pi OS POSIX.1e ACL Model Details
1.14.2.1 Basic Types of the POSIX.1e ACL Model
1.14.2.2 How Permissions Map to the Basic ACL Types
1.14.2.3 The Meaning of the “Mask” Entry
1.14.2.4 Drawbacks and Alternatives to the POSIX.1e ACL Model
1.14.2.5 Command Syntax for Setting and Viewing POSIX.1e ACLs
1.14.3 ACL Examples
Example 1.10 Setting and Viewing Access ACLs
Example 1.11 Setting and Viewing Default ACLs
1.15 Raspberry Pi OS NFS Server and Client Install and Setting NFSv4 ACLs On the Client
1.15.1 ACLs Have Two Basic Forms
1.15.1.1 ACL Entry Descriptions: Components of NFSv4 ACL Command Entry Descriptions
1.15.2 Installing and Configuring the NFS Server and Clients and Setting NFSv4 ACLs On the Client
1.16 Ufw and Netfilter Interface in the Raspberry Pi OS
1.16.1 Ufw Defaults
1.16.2 Basic Syntax, Use Case, and Rules Examples
1.16.3 Advanced Ufw Syntax
1.16.4 An Extended Example of Applying Ufw Rules
Example 1.12
1.16.5 Interpreting Ufw Log Entries in the Systemd Journal
Example 1.13 Ufw Log Entries
1.17 Encrypting Directories and Files Using Tar and Gpg
1.17.1 The Tar Command General Syntax
1.17.2 Directory Encryption
Example 1.14 Directory Encryption
1.17.3 Encrypting a User File
Example 1.15 Encryption of a Single File
1.17.4 Encrypting a USB Flash Drive
Example 1.16 How to Encrypt a USB Flash Drive
1.18 How a Process Gets Its Credentials
1.18.1 Process Capabilities
Example 1.17 Setting Capabilities On the Command Line
1.19 Namespaces and User Namespaces
Example 1.18 Namespaces
1.20 Chapter Summary
2 Applications of Systemd for the Beginner
2.0 Objectives, Commands, and Primitives Covered
2.1 Introduction – Applications of Systemd for the Beginner
2.2 Bootup in the Initial RAM Disk (Initrd)
2.2.1 Querying the Boot Process
2.3 Systemd Units and Unit Files
2.3.1 Introduction to Units and Unit Files
2.3.2 Roles Systemd Units Play
2.3.3 Unit File Locations in the File System and Editing Or Modifying Them
2.3.3.1 Editing Unit Files
2.3.4 Types of Units
2.3.5 Anatomy of a Unit File
2.3.5.1 An Example Service Unit File – Ssh.service
2.3.5.2 The General Format of Unit Files
2.3.5.3 Ssh Example Unit, Service, and Install Sections Directives
2.3.5.4 Additional Unit File Sections and Their Unit-Specific Section Directives
2.3.6 Creating Instance Units From Template Unit Files
2.3.6.1 Template and Instance Unit Names for Services
2.4 Targets
2.4.1 Basic Target Concepts
2.4.2 A Target Example: Clock-Time-Based Running of a Script File
2.4.3 Unit Management With Additional Commands
2.5 Practicing On Target Units
2.5.1 Viewing the Default Target
2.5.2 Viewing All Targets
2.5.2.1 Viewing the Currently Loaded Targets
2.5.3 Changing the Current Target By Isolating Targets
2.5.3.1 Changing the Default Target
2.5.4 Changing to Rescue Mode
2.5.5 Changing to Emergency Mode
2.5.6 Practice in Working With Targets
2.5.7 Other Systemctl Options That Work With Target Units
2.5.8 Using Target Shortcuts
2.6 Other Important Systemd Commands
2.6.1 Cgroups
2.6.1.1 Default Cgroup Hierarchies for System Resource Control
2.6.1.2 Additional Cgroup Reference Resources
2.6.1.3 Linux Namespaces
2.6.2 Journal Logging
2.6.2.1 Systemd Journal Log Messages
2.6.2.2 Using the Journalctl Command to Query the Journal
2.6.2.3 Journal Logging Basics and Applied to the Webserver2 Program
2.6.2.3.2 Journal Query Structures
2.6.2.4 Query Output Display
2.6.2.5 Journal Maintenance
2.6.2.6 Boot Process Querying
2.6.3 Systemd Timers
2.6.3.1 An Example of Clock-Time-Based Running of a Script
2.6.3.2 Example of Calendar-Based Running of the Above Script File
2.7 A Python3-Based Webserver as a “New-Style Daemon”
2.7.1 Systemd Methods of Changing the Activation Behavior of a New-Style Daemon
2.7.1.1 A Simple Sockets-Based Activation Example
2.8 Chapter Summary
Questions, Problems, and Projects
Chapter 0
Advanced Questions and Problems
Project 1
Chapter 1
Project 1
Chapter 2
Advanced Questions, Problems, and Projects
Project 1
Project 2
Project 3
Project 4
Index