Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I find the folders with specific permission in Linux?

I want to find all these folders and files in Linux so that I can change them.

share|improve this question
up vote 6 down vote accepted
find . -type d -perm 0700 -user apache -ls

change 0700 to the permission you want.

share|improve this answer
    
thnx a lot , and how can I say, find all folders with specific user, for example all folders that their owner is apache – Sam Sep 18 '12 at 18:08
2  
man find. Skip to the part which states -user uname File is owned by user (in your case user apache). – Hennes Sep 18 '12 at 18:11
2  
I have edited my answer to include username – johnshen64 Sep 18 '12 at 18:42

Not with a single command I believe. You could try something like this:

dir=.
username=$USER

{ find "$dir" -user $username -perm -u=w ;
  for gid in `id -G $username`; do 
    find "$dir" -group $gid -perm -g=w ;
  done
  find "$dir" -perm -o=w ;
} | sort | uniq

Edit: The above will list all files writable to the given user (as you originally asked), not only files with specific permissions (like rwx------).

share|improve this answer
1  
It depends if you consider 'find -perm xxxx -user apache -exec chmod yyyy' a single command. (I am not sure if I need to consider that one or two commands) – Hennes Sep 18 '12 at 18:25
    
impressive, thnx a lot ... – Sam Sep 18 '12 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .