How to find all files executed by a specific user (not current)

How to find all files that can be executed by a specific user (not the current one!)

For current, I can do it like

find /some/start/dir -executable 

But now I want to do something like: find all the files that the user can execute ("other" permissions, "user" permissions and "group" permissions). Of course, I do not know the password of the user josh, so I can not sue.

+4
source share
2 answers

See the user ID "josh" in / etc / passwd.

Then run: find / some / start / dir-type "f" -uid <ID> -perm 111 .

+3
source

I know this is an old thread, but I had to do it recently, and it is still relevant.

Since we are talking about * nix permissions, one tedious but thorough way to approach this is to look at the membership that the ID has in the system:

t

 # 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 that there may be some coincidence for files owned by josh, but also belongs to the "grpname" group. Grade | uniq will easily filter them.

0
source

All Articles