1 / 30

網路伺服器應用 Linux Server

網路伺服器應用 Linux Server. Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology andres@dlit.edu.tw http://www.cse.dlit.edu.tw/~andres. 第 4 章 系統管理. 4-1 使用者帳號管理 4-2 檔案權限管理 4-3 開機與關機 4-4 deamon. 4-1 使用者帳號管理. 群組與權限 系統管理員( root ) 每個使用者

Télécharger la présentation

網路伺服器應用 Linux Server

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 網路伺服器應用Linux Server Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology andres@dlit.edu.tw http://www.cse.dlit.edu.tw/~andres

  2. 第4章 系統管理 4-1 使用者帳號管理 4-2 檔案權限管理 4-3 開機與關機 4-4 deamon

  3. 4-1 使用者帳號管理 • 群組與權限 • 系統管理員(root) • 每個使用者 • 檔案與目錄 • root 帳號 • 系統設定管理 • adduser, userdel指令 • passwd指令

  4. useradd • 新增使用者(帳號) • useradd –D • useradd –g • useradd –s /bin/csh • useradd –f 10 • passwd • password • 設定密碼

  5. userdel • userdel • user delete • 刪除與修改使用者帳號 • userdel –t username

  6. su • switch user • 轉換使用者帳號 • su username • 轉換成root管理員 • 日常使用 Linux 時用一般使用者的帳號操作 • 需要root權限 • su -

  7. /etc/passwd, etc/shadow • /etc/passwd檔案 • 使用者的帳號與密碼等相關資料 • 使用文字編輯器來觀看這個檔案 • root:x:0:0:root:/root:/bin/bash • Username • Password • UID (user ID) • GID (group ID) • Name • Home directory • shell

  8. 4-2 檔案權限管理 • 所有軟硬體裝置通通視為檔案 • 權限管理只要在意檔案權限的設定即可 • Linux 的做法比較單純 • Linux 的安全等級比 windows 更早獲得美國國家安全局的認證。

  9. 檔案權限 • 檔案擁有者 • 擁有人(owner) • 擁有群組 (group) • 存取權限 (mode) • 某使用者帳號被移除 • 檔案忘記移除,變成無人擁有 • 檔案視同 root 所擁有

  10. 檔案權限 • drwxrwxrwx • owner • group • other • 第一個字(-/d) • file (-) or directory (d) • 每個權限都由三個位元構成 • read ( r ) • write (w) • execute (x)

  11. 檔案權限 • ls -al • rwxr-xr-x • - 沒有權限, • owner可讀寫執行 • group可讀及執行 • other可讀及執行。 • 八進位數字 755 來表示

  12. chown, chgrp • chown • change owner • 更改擁有者 • chown root filename • chgrp • change group • 更改群組 • chgrp 755 filename

  13. 4-3 開機與關機 • 開機的步驟與程序: • BIOS • Loader • OS kernel • /sbin/init • init執行 /etc/rc.d/rd.sysinit • init執行 run level • init執行 /etc/rc.d/rc.local

  14. Loader • BIOS在開機磁碟機的第 0 磁區、第 0 磁柱(MBR, master boot record) 載入開機的磁區 • 開機載入程式 (boot loader) • 「開機管理程式」可以選擇:是啟動Linux作業系統,還是Windows作業系統 • LILO • LInux LOader • /etc/lilo.conf檔案 • GRUB • 預設的開機管理程式 • Erich Stefan Boleyn設計與撰寫 • /etc/grub.conf檔案

  15. /etc/grub.conf #boot=/dev/hda default=0 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux (2.4.18-14) root (hd0,0) kernel /vmlinuz-2.4.18-14 ro root=LABEL=/ initrd /initrd-2.4.18-14.img

  16. OS kernel • 找出 kernel 所在位置,接著載入並執行它以啟動開機程序 • 一旦 kernel 載入完畢,一些基本設備也完成初始化 (initialization) • Linux kernel : • /boot/vmlunz-2.4.18-14 • Mandrake • Windows kernel

  17. kernel執行 /sbin/init • 嘗試從某個設備載入以及掛上 (mount) root filesystem • 一旦 root filesystem 被載入並掛上,會看到一行訊息像: VFS: Mounted root (ext3 filesystem) readonly • 此時系統會在 root filesystem 上找到 init 程式 ( 在 /bin or /sbin) 並執行 • init 讀取它的組態設定檔 (configuration file) /etc/inittab

  18. /etc/inittab # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault:

  19. init執行 /etc/rc.d/rc.sysinit • /etc/inittab # System initialization. si::sysinit:/etc/rc.d/rc.sysinit • 啟動基本系統服務: • 對所有磁碟執行 fsck • 載入必備的核心模組 (modules) • 啟動 swapping • 進行網路初始化 • 將指定在 fstab 內的磁碟掛上

  20. init執行 run level • 當 sysinit script 結束後,控制權回到 init 上,接著進入預設的runlevel • /etc/inittab l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6

  21. /etc/rc.d/* • 包含系統「開機與關機」時必須執行的執行檔或Script檔案 • /etc/rc.d/rcX.d/* :X表示0~6 • Link ->/etc/rc.d/init.d/* • 以「S」開頭 • startup • 進入level時要執行的檔案 • 以「K」開頭 • kill • 退出level時要執行的檔案

  22. /etc/rc.d/rc.local • init執行 /etc/rc.d/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local

  23. 開機

  24. 關機 • 少有重複開關機的現象 • /etc/rc.d/init.d/httpd restart • 重新啟動或是暫停某一項服務 • 不需重新開機

  25. 關機 • sync指令 • shutdown指令 • shutdown now • shutdown –r • shutdown –h now • shutdown –F • shutdown +3

  26. reboot • 重新啟動系統 • 預設值會自動執行sync

  27. halt • 先偵測系統的run level • halt -d • 關閉系統,但不將資料寫入記錄檔 • halt -p • 關閉系統,並關閉電源 • halt -t • 先關閉所有的網路介面之後,再關閉系統

  28. 4.4 daemon • Stand_alone • Super daemon • ***d

  29. Stand_alone • /etc/rc.d/init.d/* • /etc/rc.d/init.d/syslog start • Service syslog start

  30. Super daemon • /etc/rc.d/init.d/xinetd • /etc/xinetd.conf • /etc/xinetd.d/*

More Related