• No results found

UNIX System Administration S Y STEMS

N/A
N/A
Protected

Academic year: 2021

Share "UNIX System Administration S Y STEMS"

Copied!
37
0
0

Loading.... (view fulltext now)

Full text

(1)

UNIX System

Administration

CS 40 : INT R O DUCTIO N TO U NI X A ND L I NUX O P E R AT ING SYST E MS

(2)

Objectives

• Discuss UNIX system administration, including the following categories:

• Job scheduling/monitoring

• User management/monitoring

• File system/disk space management

(3)

Job Scheduling/Monitoring

• Multiple jobs can be run in UNIX interactively

• They can be grouped together or made conditionally to run

(4)

In the Past…

• We’ve learned that we can run a process in the background while running one currently (e.g. task &)

(5)

Revisiting at

• We’ve also used the at command to run processes in the future: $ at now+2min

> date > who > Ctrl-D

• We can actually allow and deny user to use the command at • To allow a user, add them to the file /usr/lib/cron/at.allow

(6)

crontab

• We also have available a UNIX command, cron, which is the system

process which will automatically perform tasks for you according to a set schedule

• We can edit this schedule from which these processes are performed through a program called crontab, short for “cron table”

(7)

Add a Job to the crontab

• Each job is one line in the crontab

• Each line must contain 6 pieces of information

• The first 5 pieces make up when to run the job

• The last piece is what job is going to run • More specifically…

(8)

Add a Job to the crontab (2)

m h dom mon dow command

• A number (or list of numbers, or range of numbers), m, representing

the minute of the hour

• A number (or list of numbers, or range of numbers), h, representing

the hour of the day

• A number (or list of numbers, or range of numbers), dom,

(9)

Add a Job to the crontab (3)

m h dom mon dow command

• A number (or list, or range), or name (or list of names), mon,

representing the month of the year

• A number (or list, or range), or name (or list of names), dow,

representing the day of the week

• command, which is the command to be run, exactly as it would

(10)

Add a Job to the crontab (4)

• A "number" is an integer (e.g.)

• A "list of numbers" is a set of integers separated by commas (e.g. 15, 30, 45), which would represent just those three numbers

• A "range of numbers" is a set of numbers separated by a hyphen (e.g. 10–20), which would represent all the numbers from 10 through 20, inclusive

(11)

Add a Job to the crontab (5)

Field Allowed Values

minute 0-59 hour 0-23 day of month 1-31

month 1-12 (or names)

(12)

Add a Job to the crontab (6)

• Names can also be used for the "month" and "day of week" fields

• Use the first three letters of the particular day or month (case doesn't matter)

(13)

crontab Example

• We want our job to run at 5 A.M., which would be minute 0, hour 5, every day of the month, every month, every day of the week

• We need to add a line to the bottom of the file which looks like this:

(14)

top

• Display system summary information as well as a list of tasks currently being managed by the Linux kernel

(15)

top Example

[deepak@server1 ~]$ top

top - 17:51:07 up 1 day, 2:56, 27 users, load average: 5.33, 29.71, 28.33 Tasks: 1470 total, 1 running, 1469 sleeping, 0 stopped, 0 zombie

Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st

Mem: 264114424k total, 253006956k used, 11107468k free, 66964k buffers

Swap: 33554424k total, 3260k used, 33551164k free, 245826024k cached

(16)

top Example (2)

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1960 deepak 15 0 30452 3220 1540 R 2.3 0.0 0:00.78 top 2457 root 11 -5 0 0 0 S 2.3 0.0 11:36.93 kacpid 2493 pmartprd 16 0 1397m 289m 9.8m S 0.3 0.1 18:36.07 pmrepagent 4639 pmartprd 15 0 787m 54m 4080 S 0.3 0.0 5:19.55 pmserver 14402 root RT 0 151m 5256 2872 S 0.3 0.0 1:41.40 multipathd 17886 root 10 -5 0 0 0 S 0.3 0.0 0:07.41 kondemand/11

(17)

User Management/Monitoring

• While only one user can sit in front of the screen and use the

keyboard at any one time, any number of users can log in to the system through the network

• To use the system, each user should have their own user account

(18)

UNIX Account Types

• There are three common types of accounts on a Unix system:

• Root account

• System accounts

• User accounts

• In addition, we will also talk about a concept known as the Group Account

(19)

UNIX Account Types: Root Account

• This is also called superuser

• Would have complete and unfettered control of the system

• A superuser can run any commands without any restriction

(20)

UNIX Account Types: System Account

• Those needed for the operation of system-specific components (e.g. mail accounts and the sshd accounts)

• Usually needed for some specific function on your system

(21)

UNIX Account Types: User Account

• Provide interactive access to the system for users and groups of users

• General users are typically assigned to these accounts

(22)

UNIX Account Types: Group Account

• UNIX supports a concept of Group Account, which logically groups a number of accounts

• Every account would be a part of any group account

• UNIX groups plays important role in handling file permissions and process management

(23)

UNIX User Administration Files

• Here are the main user administration files:

• /etc/passwd: keeps user account and password information; this file holds the majority of information about accounts on the Unix system

• /etc/shadow: holds the encrypted password of the corresponding account; not all UNIX systems support this file

• /etc/group: this file contains the group information for each account

(24)

Managing Users in UNIX

• We have commands to manage users in UNIX:

• useradd: adds a user account to the system

• usermod: modifies the attributes of a user account already on the system

• userdel: deletes a user account from the system

• We also can modify the password of a user using the command

passwd

(25)

Managing Groups in UNIX

• Similarly, we have commands to manage groups in UNIX:

• groupadd: adds a group to the system

• groupmod: modifies the attributes of a group already on the system

(26)

last

• Searches back through the file /var/log/wtmp (or the file designated by the -f flag) and displays a list of all users logged in (and out) since that file was created

• Examples:

$ last

(27)

last Sample Output

$ last

root pts/1 10.1.6.120 Tue Jan 28 05:59 still logged in root pts/0 10.1.6.120 Tue Jan 28 04:08 still logged in root pts/0 10.1.6.120 Sat Jan 25 06:33 - 08:55 (02:22) root pts/1 10.1.6.120 Thu Jan 23 14:47 - 14:51 (00:03) root pts/0 10.1.6.120 Thu Jan 23 13:02 - 14:51 (01:48) root pts/0 10.1.6.120 Tue Jan 7 12:02 - 12:38 (00:35)

(28)

wall

• Abbreviation of “write to all”

(29)

wall Examples

alice@sleipnir:~$ wall

Remember to brush your teeth! ^D

(30)

wall Examples (2)

alice@sleipnir:~$ cat .important_announcement Remember to brush your teeth!

alice@sleipnir:~$ wall .important_announcement # same as `wall !$`

Broadcast Message from alice@sleipnir (/dev/pts/7) at 16:15 ...

(31)

File System/Disk Space Management

• In the last lectures, we’ve spoken about how the file system is laid out in its most basic form

• In the next couple of slides, we’ll look at some of the commands

which help us with how to maintain the file system and manage our disk space and how it’s used

(32)

File System/Disk Space Management

Commands

Command Description

du Summarize disk usage

quota Restrict the amount of disk space used mount Mount file systems and remote resources umount Unmount file systems and remote resources find Search for files and perform actions when found

(33)

File System/Disk Space Management

Commands (2)

Command Description

fsck Check and repair file systems dump Backup your file system(s)

restore Restore a backed up file system tar Archive files

(34)

Printer Management

• Printing documents is an important part of any UNIX system

• Managing printers are manageable on a UNIX system as there are only a few commands to get this task done

(35)

Printer Management Commands

Command Description

lp/lpr Print, route, hold, and schedule a time for print jobs

lpstat Print information about the status of the lp print service cancel Cancel requests to line printer

lpsched Start printer services lpshut Stop printer services

(36)

CUPS

• Stands for Common UNIX Printing System

• With so many different UNIX variants these days, can be difficult to develop printer drivers to support all the different UNIX printing systems

• Provides a common printing system interface, based on the Internet Printing Protocol (IPP)

(37)

CUPS (2)

• Defines how to:

• Manage jobs

• Set printer options

• Adds security features for printing over the Internet

• Once installed, provides a complete printer management environment that includes lp, lpr, and all of their commands

References

Related documents

management by an exempt organization of an unrelated exempt organization's senior living property is not considered an exempt activity … Gordon Traditional tax‐exempt investors

Significant environmental variables are plotted as arrows (T, temperature; Sal, salinity; SPM, suspended particle matter; Chl a, chlorophyll a). Tide cycle was also included as

The upper-troposphere stratiform rain region area lags convection by 5–6 h under humid active monsoon conditions but by only 1–2 h during drier break periods, suggesting that

The project study was created to address a gap in the research on practice by exploring rural Title I charter school educators’ perspectives on benefits of, barriers to,

By participating in an export consortium, members can improve their knowledge of how to operate in foreign markets, how to improve business operations in areas not related to

Upon employment, the long-term care facility shall: (a) Notify the employee of the requirements of this section and request that the employee agree to be immunized against

Looking at the whole of the early American tradition of religion and government against the back- drop of the lived experiences of the states as well as

– administration module, is responsible for the integration of multiple modules (for example: database, access rights structure, goods categories, language versions