Bài giảng Hệ điều hành linux: Chương 5 - Ngô Văn Công

60 91 0
Bài giảng Hệ điều hành linux: Chương 5 - Ngô Văn Công

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Bài giảng Hệ điều hành linux: Chương 5 Các thao tác quản trị hệ thống cơ bản do Ngô Văn Công biên soạn cung cấp các kiến thức cơ bản như: Siêu tài khoản người dùng(superuser account), quá trình khởi động và thoát khỏi hệ thống, quản lý tài khoản người dùng,...

Các thao tác quản trị hệ thống Ngô Văn Công Nội dung       Siêu tài khoản người dùng(superuser account) Quá trình khởi động thoát khỏi hệ thống Quản lý tài khoản người dùng Quản lý hệ thống tập tin Quản lý pakage Điều khiển tiến trình root - Superuser account      Tải khoản có quyền cao hệ thống Khơng có hạn chế áp đặt tài khoản Thường dùng để trì quản trị hệ thống cách thông dụng để chuyển vào tài khoản root là: $ su Password: # tài khoản root, ý dùng lệnh # rm -rf / usr/local/oldir # rm -rf bad * Q trình khởi động khỏi hệ thống       Khởi động hệ thống khởi tạo(System Startup and Initialization) tập tin /etc/inittab chuyển đổi mức chạy(runlevel) tập tin rc Chế độ đơn người dùng(Single-user mode) Thoát khỏi hệ thống(shutdown system) Khởi động hệ thống khởi tạo      Booting the kernel Initializing device drivers Executing init in /sbin init reading /etc/inittab Executing rc files based on runlevel Boot loader(LILO,GRUB) Kernel /etc/init.d/syslogd /etc/init/mysqld … /etc/cupsd init Symbol link /etc/inittab /etc/rc3.d /etc/rc3.d/[SK]* /etc/rc5.d /etc/rc5.d/[SK]* /etc/inittab file   File format code:runlevels:action:command Runlevels # Default runlevel The runlevels used by RHS are: # - halt (Do NOT set initdefault to this) # - Single user mode # - Multiuser, without NFS # - Full multiuser mode # - unused # - X11 # - reboot (Do NOT set initdefault to this) # id:5:initdefault: Switching runlevel    Generally, Linux operates in runlevel or Edit initdefault in /etc/inittab Running init manually # init (switch to X11 mode) # init (switch to multiuser mode) # init (switch to single user mode)  Finding previous and current system run level # runlevel N5 Services start/stop at boot time        Place in /etc/rc.d/rcN.d (N=runlevel) Shell scripts Start script: Snnxxxx Kill script: Knnxxxx nn = 00 - 99: enforce executing order S10network S12syslog S99local K90network K10xfs S* and K* are symlinks to real scripts Central directory for real scripts: /etc/rc.d/init.d, /etc/init.d Linux Services There are 113 deamons, Out of them, the following are most widely used:             apmd : Power Management crond : Periodic Command Scheduler cups : Common Unix Printing System dhcpd : The DHCP server httpd : Apache Web server iptables : Kernel based Packet Filtering firewall mysqld : MySQL server sendmail : Sendmail Mail Server squid : Squid Proxy Server sshd : Open SSH and SFTP server xinetd : Provides support for telnet, ftp, talk, tftp etc ypbind : NIS Server Điều khiển tiến trình     Hiểu tiến trình Liệt kê danh sách tiến trình chạy Kết thúc tiến trình Giám sát hệ thống Hiểu tiến trình      Tiến trình chương trình nạp vào nhớ để chạy Nhiều tiến trình chạy đồng thời thời điểm Mỗi tiến trình gắn kết id nhất: PID (process ID) Tiến trình có người sở hữu(owner) quyền giống tập tin Các kiểu tiến trình    Daemon processes Background processes Foreground processes Tiến trình nền(Background processes)  Đặt ký tự & sau tên tập tin chạy      Cat > vidu.txt & Ctrl+Z : Chuyển tiến trình từ tiền cảnh sang tiến trình jobs: hiển thị tất tiến trình bg: bắt đầu tiến trình chế độ fg: chuyển tiến trình sang thành tiến trình tiền cảnh ps - liệt kê danh sách tiến trình ps [options] a: select all processes on a terminal x: select processes without controlling ttys u: display user-oriented format w: wide output  $ ps PID TTY TIME CMD 728 pts/3 00:00:00 bash 1010 pts/3 00:00:00 ps Uptime: how long server is up Free: information about memory usage kill - Kết thúc tiến trình kill [ -s signal ] pid kill -l [ signal ] default signal to send is signal TERM $ kill 728 $ kill -s SIGKILL 728 $ kill -KILL 728 $ kill -9 728 killall - kết thúc tiến trình qua tên killall [ -s signal ] name $ killall -SIGHUP syslogd $ killall -9 man top - process CPU/Memory consumption  Press h at anytime for list of interactive commands Chạy tiến trình cách tự động   Các cơng việc đòi hỏi tính tự động Hệ thống cron Các tác vụ tự động      Giúp hệ thống chạy ổn định Quan sát hệ thống Chạy thường xuyên: hourly, daily, weekly, yearly Tự động chạy mà không cần can thiệp người dùng Shell scripts Hệ thống cron    crontab files: cấu hình cron crontab commmand: câu lệnh dùng để chỉnh sửa tập tin crontab crond daemon: đọc tập tin crontab thực cơng việc Định dạng tệp crontab       minute hour day month weekday command Phút(0-59) Giờ (0-23) Ngày (1-31) Tháng (1-12) Ngày tuần (Sun=0, Mon=1, Sat=6) Chương trình chạy vào ngày thời điểm cụ thể * * * /bin/organize_data */15 * * * * /usr/bin/get_email 30 9-17 * sun,wed,sat $HOME/bin/my_report       command is run at one past every hour command is run daily at 8:17 am command is run daily at 8:17 pm command is run at am every Sunday command is run 4:42 am every 1st of the month command is run hourly on the 19th of July crontab command - maintain crontab files crontab [ -u user ] file crontab [ -u user ] { -l | -r | -e } -l: display current crontab on stdout -r: remove current crontab -e: edit current crontab $ crontab -l * * * echo “this is a test” Red Hat System wide cron      /etc/crontab /etc/cron.daily/ /etc/cron.hourly/ /etc/cron.monthly/ /etc/cron.weekly/ Q &A ... usermod [-u uid] [-g group] [-G group, ] [-d home] [-s shell] [-c comment] [-l new_name] name # usermod -u 1001 stud001 userdel [-r] name -r: remove user’s home directory # userdel -r stud001... hệ thống tệp          ext2 - common Linux filesystem msdos - MS-DOS FAT vfat - Windows 95/ 98 FAT ntfs - Windows NT/2000/XP NTFS iso9660 - CD-ROMS smbfs - SMB sharing filesystem nfs -. .. Thêm tài khoản người dùng useradd [-u uid] [-g group] [-G group, ] [-d home] [-s shell] [-c comment] name # useradd -g students -c "Student 001" stud001 passwd - set user password # passwd stud001

Ngày đăng: 30/01/2020, 00:06

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan