国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

centos 如何 根據(jù)文件權(quán)限查找文件

2016-08-22 14:42:20 1102

下面的操作時(shí)合理的:

  1. 找到具有指定權(quán)限的文件

  2. 忽略其他權(quán)限位,檢查是否和指定權(quán)限匹配

  3. 根據(jù)給定的八進(jìn)制/符號(hào)表達(dá)的權(quán)限搜索

此例中,假設(shè)目錄包含以下文件。注意這些文件的權(quán)限不同。

ls -l
total 0
-rwxrwxrwx 1 root root 0 2009-02-19 20:31 all_for_all
-rw-r--r-- 1 root root 0 2009-02-19 20:30 everybody_read
---------- 1 root root 0 2009-02-19 20:31 no_for_all
-rw------- 1 root root 0 2009-02-19 20:29 ordinary_file
-rw-r----- 1 root root 0 2009-02-19 20:27 others_can_also_read
----r----- 1 root root 0 2009-02-19 20:27 others_can_only_read

找到具有組讀權(quán)限的文件。使用下面的命令來(lái)找到當(dāng)前目錄下對(duì)同組用戶(hù)具有讀權(quán)限的文件,忽略該文件的其他權(quán)?。

find . -perm -g=r -type f -exec ls -l {} ;
-rw-r--r-- 1 root root 0 2009-02-19 20:30 ./everybody_read
-rwxrwxrwx 1 root root 0 2009-02-19 20:31 ./all_for_all
----r----- 1 root root 0 2009-02-19 20:27 ./others_can_only_read
-rw-r----- 1 root root 0 2009-02-19 20:27 ./others_can_also_read

找到對(duì)組用戶(hù)具有只讀權(quán)限的文件。

find . -perm g=r -type f -exec ls -l {} ;
----r----- 1 root root 0 2009-02-19 20:27 ./others_can_only_read

找到對(duì)組用戶(hù)具有只讀權(quán)限的文件(使用八進(jìn)制權(quán)限形式)。

find . -perm 040 -type f -exec ls -l {} ;
----r----- 1 root root 0 2009-02-19 20:27 ./others_can_only_read


提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問(wèn)題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問(wèn)題: