LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-07-2006, 03:46 PM   #1
ygloo
Member
 
Registered: Aug 2006
Distribution: slack
Posts: 323

Rep: Reputation: 30
file permissions find


how to search for dirs/files which have
permissions greater than 755?

Last edited by ygloo; 10-07-2006 at 03:47 PM.
 
Old 10-07-2006, 11:52 PM   #2
Savet
Member
 
Registered: Nov 2004
Distribution: Slackware
Posts: 73

Rep: Reputation: 15
I'm sure someone will chime in with a more graceful option....

But the simplest way that comes to mind would be to search for files that don't have that set of permissions.

ls -lR /* |grep -v rwxr-xr-x |grep -v rwxr--r-- |etc...

Then you could direct it into a file and sift through it for what you're looking for.

HTH
 
Old 10-08-2006, 12:36 AM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 241Reputation: 241Reputation: 241
you can use find command too,
Code:
find /dir -type f -perm 777 -o -perm 776 -o -perm 766 ....
Not the most elegant though...
 
Old 10-08-2006, 09:16 AM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
I'm afraid that find doesn't filter based on whether a mode is greater than something. It goes by bits, so you can say ask it to match all files with at least the read, write, and executable bit set for the owner, and at least the read and executable bit set for the group and others. To do this, you want
Code:
find -perm -755
As you can see, the (very rarely occurring) modes 756, 765, and 766 are "greater than" 755, yet they will not be matched (because of their bitwise meanings). To get those as well, try
Code:
find -perm -755 -o -perm -766
 
Old 10-09-2006, 01:25 PM   #5
soggycornflake
Member
 
Registered: May 2006
Location: England
Distribution: Slackware 10.2, Slamd64
Posts: 249

Rep: Reputation: 31
Your semantics are skewed. File permissions are bitfields, so one is not really "higher" than another. However, I assume you mean all files that are group/world writable and/or have suid/sgid/sticky bit set, in which case,

Code:
find / -perm +7022
should suffice.

find man page:

Quote:
-perm +mode
Any of the permission bits mode are set for the file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
check file permissions in a script cambie Linux - General 9 09-22-2004 12:13 AM
Unable to run /usr/sbin/pppd. --> Check permissions [solved] flosch Linux - Networking 0 05-05-2004 09:08 AM
locking a usage policy file/ftp file permissions gbow Linux - Newbie 0 02-16-2004 05:35 AM
Changing file permissions on a SAMBA file share apenney Linux - Software 0 02-11-2002 04:42 PM


All times are GMT -5. The time now is 04:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration