Title: Lesson 13Maintaining and Administering a Linux System
1Lesson 13-Maintaining and Administering a Linux
System
2Overview
- Introduction to super users.
- Exploring Linux system files, processes and
features. - Managing system startup and shutdown.
- Managing Users.
3Overview
- Installing application packages from a CD.
- Installing a printer.
- Maintaining a secure system.
4Introduction to Super Users
- The super user is the administrator of a Linux PC
system. - The super user has enormous power, both, to
enhance and to destroy, the integrity of a UNIX
or Linux system. - It is responsible for the installation,
operation, maintenance, repair, and security for
the system.
5Introduction to Super Users
- The user name or login name of the super user is
root. - The User id (uid) for the super user is 0.
- The super users home directory is / on a UNIX
system and /root on a Linux system.
6Introduction to Super Users
- Any user can switch to different user accounts,
including the super user shell. - Regular users use the su command to substitute
to any other user along with the other users
password. - Super user can also substitute users by entering
that users login name as an argument to su.
7Introduction to Super Users
- The super user shell can be started by passing a
dash argument to the su command (su -). - The super user shell initiated in this manner has
roots identity and full environment, including
the home directory and the value of the USER
variable. - If the correct password for root is provided, a
child process owned by root is started.
8Introduction to Super Users
- The super user shell can be started without
passing a dash argument to the su command (su). - The super user shell initiated in this manner
does have roots identity and powers, but it
retains the original users full environment.
9Introduction to Super Users
- The shadow file that contains login names and
encrypted passwords for all users on the system
is accessible only by root and by members of
roots group.
10Exploring System Files, Processes and Features
- A functioning system consists of many running
processes, often employing data located in system
files and directories. - These processes determine how the system behaves.
11Exploring System Files, Processes and Features
- System processes.
- System directories.
- Mounted file systems.
12System Processes
- The system program, named init, has a PID of 1,
and reads a file that contains a list of all the
system processes that should be running. - If one of the processes exits, init starts a new
one to replace it. - The programs that run constantly are often called
daemons and are started when the system is
booted.
13System Directories
- Files containing system data and programs reside
in the root directory. - Each directory in the root directory is owned by
the super user and has a role in making the
system function.
14Mounted File Systems
- On UNIX/Linux systems, all disk storage is
integrated into a single directory hierarchy. - The mount utility, when run without any
arguments, simply displays a list of the mounted
file systems and their mount points. - The file systems are referred by names of their
hardware device, and the mount points by
directory names.
15Managing System Startup and Shutdown
- The procedures for starting up and shutting down
a UNIX/Linux system are automated, but require
some administrative intervention. - The shutdown -h 30 command instructs shutdown
to wait for 30 seconds and then halt the system.
16Managing System Startup and Shutdown
- The shutdown utility notifies the users of the
impending shutdown and tells them to log off. - The shutdown -r now command reboots the system
without any delay.
17Managing System Startup and Shutdown
- Rescuing with a boot disk.
- Recovering if super users password is unknown.
- Changing the state at startup.
18Rescuing with a Boot Disk
- A rescue boot disk can usually allow your system
to reboot when it cannot boot on its own. - Almost all Linux distributions prompt you to
create an emergency boot floppy during
installation. - The boot floppy contains only the Linux kernel,
which is just enough to get the system started
again.
19Recovering if Super Users Password is Unknown
- If the root password is forgotten, then the boot
floppy can be used to rescue a system. - The system can work in a state called single user
mode. Only the super user is logged on. - The single user mode entrance is
password-protected.
20Changing the State at Startup
- Linux can work in one of the following states
- 0 Halt. In state 0, the system is off.
- 1 Single user mode.
- 2 Multi-user mode without NFS.
- 3 Multi-user with NFS.
- 4 Not defined.
- 5 Graphical interface.
- 6 Reboot.
21Changing the State at Startup
- When the system is booted, it automatically goes
to one of the states 2 through 5. - The system administrator can change the current
state and the default startup state of the
system. - The definitions for various states are in the
inittab file. - The line id3initdefault controls the init
states that the system goes to when it is booted.
22Managing Users
- Adding users.
- Adding and changing passwords.
- Compressing and uncompressing individual files.
23Adding Users
- The adduser username command creates a new user
named username and copies all default files from
/etc/skel. - The passwd username command is used to add a
password to the newuser account. - The /etc/passwd file has a single line entry for
every user who has access to the system.
24Adding and Changing Passwords
- The super user can create new passwords for new
users and modify passwords for existing users. - The /etc/shadow file is in the encrypted version
only, so the old password cannot be recovered. - The only choice is to use super user powers to
assign a new password for the user.
25Compressing and Uncompressing Individual Files
- The gzip and gunzip utilities compress and
expand individual files. - A compressed file gets the extension .gz, which
is removed when the file is expanded.
26Compressing and Uncompressing Individual Files
- Tar Archives
- The name tar is derived from tape archive.
- This command packs the contents of a directory
and all its subdirectories and files into a
single file, retaining file information such as
permissions.
27Compressing and Uncompressing Individual Files
- Tar Archives (continued)
- The tar command can also be used to compress
large files or directories. - With the z option, the tar utility creates an
archive and compresses it in one step.
28Installing Application Packages from a CD
- Linux includes a powerful package manager,
developed by Red Hat, called RPM for Redhat
Package Manager. - It is used to build, install, query, uninstall,
update, and verify individual software packages
on a system.
29Installing Application Packages from a CD
- An RPM package consists of an archive of files
plus package information, including name,
version, and description. - In order to access a drive, it has to be mounted
on a directory in the root file system.
30Installing a Printer
- In UNIX and Linux, driver programs interpret
standard signals (for point size, font, indent,
and so forth) to the appropriate signal for each
particular printer. - The printconf-tui utility is used to configure
a printer.
31Installing a Printer
- The system starts a printer daemon program,
called a spooler. - The spooler accepts jobs from users and puts them
on a queue. - The print queue is a list of jobs from different
users that are waiting to be printed.
32Maintaining a Secure System
- As administrators, our task is to protect the
data from being read or copied by unauthorized
users. - Physical security means protecting hardware such
as terminals, printers, the CPU, and magnetic
media.
33Maintaining a Secure System
- Data security depends on the security of the
hardware. - File permissions are essential. Employing
directory permissions to prohibit all but
essential users from accessing a directory tree
is the strongest defense.
34Summary
- The system administrator (root having super user
powers) is responsible for the hardware, data,
applications, users, and security of the system. - Many system control files are located in the /etc
directory. They provide startup information to
the system, to processes, and to user programs.
35Summary
- Partitions on hard drives can be mounted onto the
root partition of a system so that various parts
of the drive (or other drives) can be accessed
through the file system. - Mount Lists all partitions currently mounted on
the system. - The command tar cvf filename directory creates
an archive of the files and directories in the
tree starting at directory and names it filename.
36Summary
- The command tar xvf filename extracts all files
and directories from the archive filename. - The command rpm -ivh packagename extracts all
files and directories from the RPM archive
packagename and installs them on the system.
37Summary
- su Starts a child super user shell with full
root environment. - su Starts a child super user shell maintaining
the users environment, not the super users. - Ps aux Lists all processes, including user
names. - Ps -lax Lists all processes, including PID,
UID, and PPID.