Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to write a permission fix script that uses find to fix permissions on files.

Mainly what I need is a find command that is able to list all files with execute bit set, regardless of the other permissions on the file (that's the trick).

share|improve this question

migrated from serverfault.com Jul 22 '13 at 2:34

This question came from our site for professional system and network administrators.

2  
What have you already tried? What research have you done? As written right now, you're just asking us to do your work for you, and you haven't shown any effort whatsoever in solving this yourself. –  EEAA Jul 21 '13 at 14:30
    
Also, I'd highly recommend reading up on what types of questions are appropriate here before posting any more questions. You have quite a string of closed and down voted questions, and if not careful, you will likely run afoul of the automatic question ban. –  EEAA Jul 21 '13 at 14:40
    
@EEAA: Sadly, I doubt that's anywhere near close to happening. If you have any rep at all it's really hard to get q-banned. –  Iain Jul 21 '13 at 14:46
    
@Iain - fair enough. Hopefully he'll still heed the advice, though. –  EEAA Jul 21 '13 at 14:47
2  
@EEAA: I hope so too but people who can't be bothered to read manuals generally don't heed advice - they just find it easier to whinge about our attitude ... iyswim ;) –  Iain Jul 21 '13 at 14:50

2 Answers 2

Believe it or not this is extensively documented in the find man page. On the CentOS and Ubuntu systems I have to hand there are even examples of this.

-perm /mode

Any of the permission bits mode are set for the file. Symbolic modes are accepted in this form. You must specify u',g' or `o' if you use a symbolic mode. See the EXAMPLES section for some illustrative examples. If no permission bits in mode are set, this test matches any file (the idea here is to be consistent with the behaviour of -perm -000).

So

find  . -perm /u+x

will find files where execute permission is set for the owner

find . -perm /u+x,o+x

will find files where execute permission is set for the owner and other and so on.

share|improve this answer

On GNU's find:

find /dir -type f -executable

On other versions, see the man page around -perm.

share|improve this answer

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.