Ubuntu – Find files based on permission

command linefindpermissions

How can I find a list of files that have some specific permissions?

I want to find files owned by root user that have rwx permission for the owner.

Is there any way to find a list of such files? I am using Ubuntu 16.04.

Best Answer

  • Yes, GNU find can do it:

    -user uname

    File is owned by user uname (numeric user ID allowed).

    -perm -mode

    All of the permission bits mode are set for the file. Symbolic modes are accepted in this form, and this is usually the way in which you would want to use them. You must specify 'u', 'g' or 'o' if you use a symbolic mode. See the EXAMPLES section for some illustrative examples.

    So, you want:

    find /path/to/directory -user root -perm -u+rwx