Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 3 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.