Book Image

Ubuntu 20.04 Essentials

By : Neil Smyth
Book Image

Ubuntu 20.04 Essentials

By: Neil Smyth

Overview of this book

Ubuntu is undeniably one of the most highly regarded and widely used Debian-based Linux distributions available today. Thanks to its ease of use and reliability, Ubuntu has a loyal following of Linux users and an active community of developers. Ubuntu 20.04 Essentials is designed to take you through the installation, use, and administration of the Ubuntu 20.04 distribution in detail. For beginners, the book covers topics such as operating system installation, the basics of the GNOME desktop environment, configuring email and web servers, and installing packages and system updates. Additional installation topics such as dual booting with Microsoft Windows are also covered along with crucial security topics such as configuring a firewall and user and group administration. For the experienced user, the book delves into topics such as remote desktop access, the Cockpit web interface, logical volume management (LVM), disk partitioning, and swap management. Further, it also explores KVM virtualization, Secure Shell (SSH), Linux containers, and file sharing using both Samba and NFS to provide a thorough overview of this enterprise-class operating system.
Table of Contents (38 chapters)
38
Index

1.1 Superuser Conventions

Ubuntu, in common with Linux in general, has two types of user account, one being a standard user account with restricted access to many of the administrative files and features of the operating system, and the other a superuser (root) account with elevated privileges. Typically, a user can gain root access either by logging in as the root user, or using the su - command and entering the root password. In the following example, a user is gaining root access via the su - command:

[neil@demo-server ~]$ su -

Password:

[root@demo-server ~]#

Note that the command prompt for a regular user ends with a $ sign while the root user has a # character. When working with the command-line, this is a useful indication as to whether or not you are currently issuing commands as the root user.

If the su - command fails, the root account on the system has most likely been disabled for security reasons. In this case, the sudo command can be used instead as outlined below.

Using sudo, a single command requiring root privileges may be executed by a non-root user. Consider the following attempt to update the operating system with the latest patches and packages:

$ apt update

Reading package lists... Done

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

Optionally, user accounts may be configured so that they have access to root level privileges. Instead of using the su - command to first gain root access, user accounts with administration privileges are able to run otherwise restricted commands using sudo.

$ sudo apt update

[sudo] password for demo:

Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease

.

.

To perform multiple commands without repeatedly using the sudo command, a command prompt with persistent super-user privileges may be accessed as follows:

[neil@demo-server]$ sudo su -

[neil@demo-server]#

The reason for raising this issue so early in the book is that many of the command-line examples outlined in this book will require root privileges. Rather than repetitively preface every command-line example with directions to run the command as root, the command prompt at the start of the line will be used to indicate whether or not the command needs to be performed as root. If the command can be run as a regular user, the command will be prefixed with a $ command prompt as follows:

$ date

If, on the other hand, the command requires root privileges, the command will be preceded by a # command prompt:

# apt install openssh-server