1 / 9

檔案權限的設定與初始值

檔案權限的設定與初始值. 檔案的屬性. 共分為 七個欄位 ,其中第一個欄位為檔案的權限. 檔案的權限. 檔案類型 [ d ] 是目錄 [ - ] 是檔案. 檔案 / 目錄權限的意義. 一般檔案 r 可 讀取 該檔案的內容 w 可 修改 / 編輯 檔案的內容 x 可執行該檔案 目錄檔案 r 可 列出 目錄中的檔案 w 可在該目錄內建立 / 刪除檔名 ( 異動某目錄 結構 ) x 可進入該目錄. 權限的應用. 進入某目錄所需的基本權限

Download Presentation

檔案權限的設定與初始值

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. 檔案權限的設定與初始值

  2. 檔案的屬性 • 共分為七個欄位,其中第一個欄位為檔案的權限

  3. 檔案的權限 • 檔案類型 • [ d ]是目錄 • [ - ]是檔案

  4. 檔案/目錄權限的意義 • 一般檔案 • r 可讀取該檔案的內容 • w 可修改/編輯檔案的內容 • x 可執行該檔案 • 目錄檔案 • r 可列出目錄中的檔案 • w 可在該目錄內建立/刪除檔名(異動某目錄 • 結構) • x 可進入該目錄

  5. 權限的應用 • 進入某目錄所需的基本權限 • 該目錄需具備 x 權限 (才能進入) • 使用者可在該目錄查閱檔名,需具備 r 權限 (才可顯示) • 讀取一個目錄中檔案內容所需的基本權限 • 該檔案所在的目錄至少要有 x 權限 (才能進入目錄) • 該檔案至少要有 r 權限 (才能開啟) • 修改一個目錄中檔案所需的基本權限 • 該檔案所在的目錄至少要有 x 權限 (才能進入目錄) • 該檔案至少要有 w 權限(若要開啟再編輯則需r,w)

  6. 權限的應用(續) • 建立一個檔案所需的基本權限 • 該目錄至少要具有 w,x的權限 (才能進入並建檔)

  7. 檔案權限的修改 ugoa • +(加入) • (減去) • =(指定) • 利用符號表示 • chmoda+xrun.shrwxrwx--x • chmod a-x run.shrw-rw---- • chmod a=x run.sh --x--x--x • 利用數字表示 • chmod 777 run.sh  rwxrwxrwx • Chmod 744 run.sh  rwxr--r-- • Chmod 700 run.sh  rwx------ 421 rwx chmod 檔案或目錄

  8. umask 預設權限 • 新建檔案/目錄的預設權限 • umask顯示的結果為『拿掉的權限』 • 預設權限在目錄/檔案並不相同 • 目錄:drwxrwxrwx(因為 x 對目錄很重要) • 檔案:-rw-rw-rw-(因為檔案預設並不可執行) • umask 022 指定預設權限 • 目錄:drwxr-xr-x 777-022755 • 檔案:-rw-r—r-- 666-022644 • 一般使用者預設的umask為002

  9. 練習 • 建立一個新檔案 • 修改某個檔案的權限 • 請以數字法修改 • 請以符號法修改

More Related