Basic Administration Tasks Chapter 8 Guide to Linux Installation and Administration, 2e

advertisement
Chapter 8
Basic Administration
Tasks
Guide to Linux Installation and Administration, 2e
1
Objectives
In this chapter, you will:
• Create and manage Linux user accounts
• Install and maintain types of Linux systems
• Manage processes on Linux using basic
commands
Guide to Linux Installation and Administration, 2e
2
Valued Gateway
Client:
Managing User Accounts
• To complete any operation in Linux, a person
must first log in using a valid user account name
and password
• Setting up and maintaining these user accounts
is an important part of the work of a system
administrator
Guide to Linux Installation and Administration, 2e
3
Valued Gateway
Client:
Types of User Accounts
• Types of user accounts include:
– root account
– Regular accounts
– Special accounts
Guide to Linux Installation and Administration, 2e
4
Valued Gateway
Client:
The root Account
• The administrative account (the superuser) on a
Linux system is named root
• The root user can perform any operation on a
Linux system
• The su utility (for substitute user) temporarily
changes your access rights to those of another
user
Guide to Linux Installation and Administration, 2e
5
Valued Gateway
Client:
Regular Users
• Regular user accounts are for users who log in at
a keyboard and use the Linux system
• Regular user account names typically use a
combination of first name or initial and last name
or initial
Guide to Linux Installation and Administration, 2e
6
Valued Gateway
Client:
Special Users
• Special accounts cannot be used to log in
• Special accounts are used by programs running
on Linux
Guide to Linux Installation and Administration, 2e
7
Valued Gateway
Client:
Linux Groups
• A group is a collection of user accounts that can
be collectively granted access to files and
directories
• A user can be a member of multiple groups, but
can only have one primary group
• A User Private Group system creates a group
with a single member for each new user account
Guide to Linux Installation and Administration, 2e
8
A User as a Member of Multiple Groups
Guide to Linux Installation and Administration, 2e
9
Valued Gateway
Client:
User and Group Files
• User account information is stored in the file
/etc/passwd
• To edit the /etc/passwd file, use the special
editing program vipw
• Groups on a Linux system are defined in
/etc/group
• To edit the /etc/group file, use the command vigr
Guide to Linux Installation and Administration, 2e
10
Valued Gateway
Client:
Shadow Passwords
• Encrypted passwords are stored in /etc/shadow
• Regular users cannot read encrypted passwords
• Shadow Password Suite is a collection of
password-related programs that have been
modified to recognize the /etc/shadow file
Guide to Linux Installation and Administration, 2e
11
Valued Gateway
Client:
Creating New User Accounts
• New user accounts can be created
– With the useradd command
– With various graphical utilities
• Default settings apply when using the useradd
command alone
• Default settings can be modified on the command
line or by editing a configuration file for useradd
Guide to Linux Installation and Administration, 2e
12
Configuring Users Graphically in Red
Hat Linux 7.3
Guide to Linux Installation and Administration, 2e
13
useradd Command Options
Guide to Linux Installation and Administration, 2e
14
Valued Gateway
Client:
Changing User Passwords
• A password is not defined by useradd when a
new user account is created
• The passwd command is used to define or
change a user’s password
• You must enter the new password twice
Guide to Linux Installation and Administration, 2e
15
Valued Gateway
Client:
Creating New Groups
• To create a new group, use the groupadd
command
• To add a new group, include the group name as a
parameter
Guide to Linux Installation and Administration, 2e
16
Valued Gateway
Client:
Modifying User and Group Accounts
• The usermod command allows you to modify
user account parameters stored in /etc/passwd or
/etc/shadow
• The groupmod command lets you modify
membership of a group
Guide to Linux Installation and Administration, 2e
17
Valued Gateway
Client:
Automating Home Directory Creation
• Files contained in /etc/skel are automatically
copied into each user’s home directory at the
time you create the account
• You should place files in /etc/skel when you first
install Linux
Guide to Linux Installation and Administration, 2e
18
Valued Gateway
Client:
Disabling User Accounts
• You can temporarily or permanently disable a
user account
• Accounts can be deleted using the userdel
command
• To temporarily disable a user’s account, change
the password with the passwd command
Guide to Linux Installation and Administration, 2e
19
Valued Gateway
Client:
Maintaining File Systems
• File system refers to an organized set of data that
can be accessed via the standard Linux directory
structure
• To access a file system in Linux, it must first be
mounted into the root directory structure
• A mount point is the path in the directory
structure where you access the data in a file
system
• Use the mount command to make a new file
system accessible via a mount point
Guide to Linux Installation and Administration, 2e
20
Automatically Mounted File Systems
Guide to Linux Installation and Administration, 2e
21
File Systems Mounted in a Linux
Directory Structure
Guide to Linux Installation and Administration, 2e
22
Valued Gateway
Client:
Checking File System Status
• The df command displays space usage
information for each file system that is currently
mounted
• The du utility lists the size of a directory and all
its subdirectories
• You can use various graphical tools and system
administration scripts to check the status of file
systems
Guide to Linux Installation and Administration, 2e
23
Valued Gateway
Client:
Creating New File Systems
• You can install new file systems that are
permanent or temporary
• File systems can be stored on a device with
removable media or fixed media
• Once the hard disk or other device is installed,
you can use the Linux fdisk command to examine
its partitions, creating new Linux partitions
Guide to Linux Installation and Administration, 2e
24
Valued Gateway
Client:
Using the fdisk Utility
• To manage partitions in Linux after the operating
system is installed, use the fdisk utility
• The fdisk utility can configure partition data on a
hard disk
• Your modifications to the partition table are only
effective when you write the changes to disk with
the w command to exit fdisk
Guide to Linux Installation and Administration, 2e
25
fdisk Commands
Guide to Linux Installation and Administration, 2e
26
Sample Output of the p Command in
fdisk
Guide to Linux Installation and Administration, 2e
27
Valued Gateway
Client:
Formatting File Systems
• File system journaling is a feature that protects
against data corruption by tracking each “write”
to the hard disk in a special way so that it will
either be completely finished or left completely
undone
• New partitions must be formatted using mke2fs
or mkswap before they can be used
Guide to Linux Installation and Administration, 2e
28
Valued Gateway
Client:
Mounting File Systems
• After you have formatted a file system, you can
mount it
• To access a file system, you use the mount
command
• The floppy disk drive and CD-ROM drive are
mounted to /mnt/floppy and /mnt/cdrom
Guide to Linux Installation and Administration, 2e
29
Valued Gateway
Client:
Unmounting File Systems
• To unmount a file system, use the umount
command with the device name or mount
point
• A file system cannot be in use when you
unmount it
Guide to Linux Installation and Administration, 2e
30
Valued Gateway
Client:
Automating File System Mounting
• The new file systems that you create from
additional hard disks or other devices can also be
automatically mounted at boot time
• The key to automounting file systems is the
/etc/fstab configuration file which contains one
line for each file system that you want to have
automounted when Linux boots
Guide to Linux Installation and Administration, 2e
31
Option Field Settings for the mount
Command
Guide to Linux Installation and Administration, 2e
32
Valued Gateway
Client:
Managing Swap Space
• The swap space is a special partition type used
by the Linux kernel for virtual memory
• You can use the mkswap command to format a
swap partition
• Swap space is activated by the swapon command
within the system initialization scripts
• The vmstat command displays current status
details for how virtual memory is being used
Guide to Linux Installation and Administration, 2e
33
Valued Gateway
Client:
Setting Quotas on Disk Usage
• Limits on the amount of hard disk space that any
user or group can use are called disk quotas
• Use the edquota command to establish a quota
for one or more users or groups
• Activate the quota system using the quotaon
command
Guide to Linux Installation and Administration, 2e
34
Valued Gateway
Client:
Simple Task Management
• To control processes running on Linux, you can
use the following:
– The ps command
– The bg command
– The fg command
Guide to Linux Installation and Administration, 2e
35
Valued Gateway
Client:
Job Control in the Shell
• When you start a program, that program takes
control of the command line where you are
working
• The jobs command lists all jobs or processes that
are running from the current shell
• The fg command places processes in the
foreground
• The bg command places processes in the
background command
Guide to Linux Installation and Administration, 2e
36
Valued Gateway
Client:
Using Virtual Consoles
• A virtual console is a separate login screen that
you access by pressing a combination of keys on
your keyboard
• A virtual console allows you to start multiple textbased login sessions on the same computer
• The virtual consoles are assigned to the function
keys
Guide to Linux Installation and Administration, 2e
37
Valued Gateway
Client:
Learning about Processes
• A simple ps command shows you only the
commands that you have started in the current
command-line environment
• Multiple processes can be started from a single
shell
Guide to Linux Installation and Administration, 2e
38
Valued Gateway
Client:
Controlling Processes
• The kill command is used to kill, or end,
processes
• Signals are messages that can be sent between
processes
• The killall command sends a signal to all
processes started by a given command
Guide to Linux Installation and Administration, 2e
39
Summary
• Types of user accounts include root, regular
accounts, and special accounts
• New user accounts can be created with the
useradd command or with various graphical
utilities
• New groups can be created with the groupadd
command
• File systems are accessed by using the mount
command to specify a device and a mount point
• The df and du commands display status and size
information about file systems
Guide to Linux Installation and Administration, 2e
40
Summary
• The fdisk utility can configure partition data on a
hard disk.
• The vmstat command displays how virtual
memory is being used
• Within a shell, the jobs command manages these
processes, placing them in the foreground or
background
• Virtual consoles let you log in at multiple
independent text-mode screens
• The kill command sends signals to processes or
to the Linux kernel when necessary to end a
process
Guide to Linux Installation and Administration, 2e
41
Download