許可權 對於檔案
r 可讀
w 可寫
x 可執行
對於資料夾
r 能夠列出資料夾的內容(ls)
w 能夠在資料夾中建立和刪除檔案(touch/rm)
x 能夠進入資料夾(cd)
一、chmod
chmod用來改變許可權
經常使用的方式
1、用ugo+rwx 或者ugo-rwx或者ugo=rwx改變許可權
這裡的ugo
u 使用者
g 使用者組
o 其它人
比方:ug+x 就是為使用者和使用者組新增可執行許可權
舉例:
[root@localhost testforcsdn]# ls -l testfile
-rw-r----- 1 root root 0 nov 1 22:14 testfile
為其它人賦予讀寫許可權
[root@localhost testforcsdn]# chmod o=rw testfile
[root@localhost testforcsdn]# ls -l testfile
-rw-r--rw- 1 root root 0 nov 1 22:14 testfile
為其它人去掉寫的許可權
[root@localhost testforcsdn]# chmod o-w testfile
[root@localhost testforcsdn]# ls -l testfile
-rw-r--r-- 1 root root 0 nov 1 22:40 testfile
為使用者組加入寫的許可權
[root@localhost testforcsdn]# chmod g+w testfile
[root@localhost testforcsdn]# ls -l testfile
-rw-rw-r-- 1 root root 0 nov 1 22:40 testfile
2、用數字的方式改變許可權
r相應4
w相應2
x相應1
比方:5=4+1 那麼5代表的就是可讀和可執行許可權
舉例建立乙個空檔案,而且檢視許可權,能夠看到,當前許可權是rw-r--r--
也就是說:
對說有著來說是rw- 可讀可寫不可執行
對所屬組來說是r-- 僅僅可寫
對其它人來說是r-- 僅僅可寫
舉例建立乙個指令碼。而且賦予它全部者的可執行許可權
[root@localhost testforcsdn]# touch test.script
[root@localhost testforcsdn]# ls -l test.script
-rw-r----- 1 root root 0 nov 1 22:43 test.script
[root@localhost testforcsdn]# chmod 744 test.script
[root@localhost testforcsdn]# ls -l test.script
-rwxr--r-- 1 root root 0 nov 1 22:43 test.script
二、chown
改變全部者
首先加入使用者hwc
[root@localhost testforcsdn]# useradd hwc
[root@localhost testforcsdn]# chown hwc test.script
[root@localhost testforcsdn]# ls -l test.script
-rwxr--r-- 1 hwc root 0 nov 1 22:43 test.script
三、chgrp
改變所屬組
首先加入使用者組hwcgroup
[root@localhost testforcsdn]# chgrp hwcgroup test.script
[root@localhost testforcsdn]# ls -l test.script
-rwxr--r-- 1 hwc hwcgroup 0 nov 1 22:43 test.script
四、umask
檔案和資料夾建立的預設許可權
檢視預設許可權
[root@localhost ~]# umask
0022
解釋下,這裡的第乙個0是特殊許可權位。一般不作考慮
022是使用者許可權位,這裡的是掩碼值
對於檔案
即實際的許可權應該是完整的許可權777-022-111 = 644
就是rw-r--r--
改變預設的許可權值
[root@localhost ~]# umask 027
[root@localhost ~]# umask
0027
Linux的四個查詢命令
find命令我們通過man命令可以看到如下資訊 find search for files in a directory hierarchyfind命令用於在目錄結構中搜尋命令,並可以執行指定操作。在不指定查詢目錄的情況下,find會動這個系統進行遍歷。即使系統中含有網路檔案系統,find同樣有效。...
2 四個常用的HTML標籤
二 建立例項 後記z 1 6.com 學習一門語言的最好方法就是編寫邊做,筆者通常使用notepad 進行編輯,下面介紹四個常用的html標籤。前面的教程裡面已經給大家測試過了,html 標題 heading 有6個級別,分別通過 利用上面的四個基本標籤,建立乙個例項,具體如下 doctype ht...
移動端常用的四個框架
優點 不用寫很多css,拿過來就可以使用 沒有js庫可以自己寫js 不會有那麼多衝突 缺點 適用場合不多 官方 根本沒有官方文件,只能是在github主頁上找到 適用於使用手q規範設計的web頁面,而針對非手q規範的頁面,可通過修改變數定製介面主題。優點 基礎樣式效果簡單色調清爽 優點 極簡 mui...