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

幫助中心 >  技術(shù)知識庫 >  云服務器 >  服務器教程 >  centos 如何 根據(jù)文件權(quán)限查找文件

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

2016-08-22 14:42:20 1101

下面的操作時合理的:

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

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

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

此例中,假設目錄包含以下文件。注意這些文件的權(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)限的文件。使用下面的命令來找到當前目錄下對同組用戶具有讀權(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

找到對組用戶具有只讀權(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

找到對組用戶具有只讀權(quá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


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

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

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

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