How to find all files which can be executed by specific user (not current!)
For current I can do it like
find /some/start/dir -executable
But now I want to do something like: find all files which user 'josh' can execute (by 'other' permissions, 'user' permissions and 'group' permissions). Of course, I do not know users's 'josh' password so I cannot su'ing.
Look up the user id of "josh" in /etc/passwd.
Then run: find /some/start/dir -type "f" -uid <ID> -perm 111.
I know this is an older thread, but I had to do this recently and it is still relevant.
Since we're talking about *nix permissions, one tedious yet thorough way to approach this is by looking at the membership that the ID has on the system:
ie:
# assuming josh is a member of group "grpname"
find / -user josh -perm -100 # gets files owned by josh & are executable
find / -group grpname -perm -010 # gets files with grp ownership and executable
# via group
# Must be repeated for each group josh is in
find / -perm -001 # gets files executable by any user
Note there could be some overlap for files that josh owns but are also owned by group "grpname". A sort|uniq would filter those out pretty easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With