手机看片精品高清国产日韩,色先锋资源综合网,国产哺乳奶水91在线播放,乱伦小说亚洲色图欧洲电影

幫助中心 >  技術知識庫 >  云服務器 >  服務器教程 >  centos 如何 根據文件權限查找文件

centos 如何 根據文件權限查找文件

2016-08-22 14:42:20 197

下面的操作時合理的:

  1. 找到具有指定權限的文件

  2. 忽略其他權限位,檢查是否和指定權限匹配

  3. 根據給定的八進制/符號表達的權限搜索

此例中,假設目錄包含以下文件。注意這些文件的權限不同。

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

找到具有組讀權限的文件。使用下面的命令來找到當前目錄下對同組用戶具有讀權限的文件,忽略該文件的其他權?。

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

找到對組用戶具有只讀權限的文件。

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

找到對組用戶具有只讀權限的文件(使用八進制權限形式)。

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


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

這條文檔是否有幫助解決問題?

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

在文檔使用中是否遇到以下問題: