LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-05-2008, 03:55 PM   #1
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Rep: Reputation: 30
Find by permission


How do I show:

A list of files and directories, recursively, who's public permission is not +r.

I was looking at -perm in find and it looks like it can only find a specific xxx perm? Or else I can't figure it out...
 
Old 03-05-2008, 05:14 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Code:
find \! -perm +004 -ls
?
 
Old 03-05-2008, 05:30 PM   #3
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Tinkster View Post
Code:
find \! -perm +004 -ls
?

%find \! -perm +004
usage: find [-H | -L | -P] [-EXdsx] [-f file] [file ...] [expression]
%find \! -perm +004 -ls
usage: find [-H | -L | -P] [-EXdsx] [-f file] [file ...] [expression]

I also tried:

find ./ -perm +004
find ./ -perm -004

Both just listed everything.

rw
 
Old 03-05-2008, 05:38 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
What OS and which version of find is this with? And what's with the ugly prompt,
are you using tcsh? :}



Cheers,
Tink
 
Old 03-05-2008, 05:47 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Code:
$ cat /etc/slackware-version 
Slackware 12.0.0

$ find --version
GNU find version 4.2.31
Built using GNU gnulib version 2007-02-24
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION
Code:
 $ find \! -perm +004 -ls
  1889    1 drwx------   2 tink     users         632 Mar  4 09:22 .
 14026    4 -rw-------   1 tink     users         189 Oct  2  2006 ./bittornado-0.3.15-noarch-1.tgz.asc
 14028    4 -rw-------   1 tink     users         148 Nov 22  2004 ./blank.gif
 14017   60 -rw-------   1 tink     users       57443 Jun  2  2007 ./CHECKSUMS.md5
 14022    4 -rw-------   1 tink     users        1279 Feb  8  2006 ./README
 14019   76 -rw-------   1 tink     users       77167 Jun  2  2007 ./FILE_LIST
 14029    4 -rw-------   1 tink     users        1038 Nov 22  2004 ./compressed.gif
 14031    4 -rw-------   1 tink     users         217 Nov 22  2004 ./hand.right.gif
 14039    4 -rw-------   1 tink     users         229 Nov 22  2004 ./text.gif
 14030    4 -rw-------   1 tink     users         225 Nov 22  2004 ./folder.gif
 14040    4 -rw-------   1 tink     users         245 Nov 22  2004 ./unknown.gif
 14024    4 -rw-------   1 tink     users         216 Nov 22  2004 ./back.gif
 14025  292 -rw-------   1 tink     users      296826 Oct  2  2006 ./bittornado-0.3.15-noarch-1.tgz
 14027    4 -rw-------   1 tink     users         444 Oct  2  2006 ./bittornado-0.3.15-noarch-1.txt


$ find -ls 
  1889    1 drwx------   2 tink     users         632 Mar  4 09:22 .
 14026    4 -rw-------   1 tink     users         189 Oct  2  2006 ./bittornado-0.3.15-noarch-1.tgz.asc
 14028    4 -rw-------   1 tink     users         148 Nov 22  2004 ./blank.gif
 14017   60 -rw-------   1 tink     users       57443 Jun  2  2007 ./CHECKSUMS.md5
 14022    4 -rw-------   1 tink     users        1279 Feb  8  2006 ./README
 14021   68 -rw-r--r--   1 tink     users       66052 Jun  2  2007 ./PACKAGES.TXT
 14019   76 -rw-------   1 tink     users       77167 Jun  2  2007 ./FILE_LIST
 14018    4 -rw-r--r--   1 tink     users         189 Jun  2  2007 ./CHECKSUMS.md5.asc
 14029    4 -rw-------   1 tink     users        1038 Nov 22  2004 ./compressed.gif
 14031    4 -rw-------   1 tink     users         217 Nov 22  2004 ./hand.right.gif
 14039    4 -rw-------   1 tink     users         229 Nov 22  2004 ./text.gif
 14023    4 -rw-r--r--   1 tink     users         149 Feb  9  2002 ./README.TXT
 14030    4 -rw-------   1 tink     users         225 Nov 22  2004 ./folder.gif
 14040    4 -rw-------   1 tink     users         245 Nov 22  2004 ./unknown.gif
 14024    4 -rw-------   1 tink     users         216 Nov 22  2004 ./back.gif
 14025  292 -rw-------   1 tink     users      296826 Oct  2  2006 ./bittornado-0.3.15-noarch-1.tgz
 14027    4 -rw-------   1 tink     users         444 Oct  2  2006 ./bittornado-0.3.15-noarch-1.txt
 14020  637 -rw-r--r--   1 tink     users      648915 Jun  2  2007 ./MANIFEST.bz2

Cheers,
Tink

Last edited by Tinkster; 03-05-2008 at 05:49 PM.
 
Old 03-05-2008, 06:01 PM   #6
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
%find --version
find: illegal option -- -
find: illegal option -- v
find: illegal option -- e
find: illegal option -- r
find: illegal option -- i
find: illegal option -- o
find: illegal option -- n
usage: find [-H | -L | -P] [-EXdsx] [-f file] [file ...] [expression]

%find -v
find: illegal option -- v
usage: find [-H | -L | -P] [-EXdsx] [-f file] [file ...] [expression]
 
Old 03-05-2008, 06:46 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And the answer to http://www.linuxquestions.org/questi...81#post3079381 ?


Cheers,
Tink
 
Old 03-05-2008, 07:06 PM   #8
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Oh I missed that post sorry. I don't know, how do I tell what shell I'm using? Oh found it:

%echo $0
-csh

How do I tell the distro/os?
 
Old 03-05-2008, 07:59 PM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
uname -a
is a start.
 
Old 03-05-2008, 08:18 PM   #10
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Tinkster View Post
uname -a
is a start.
Oh hell, I feel like an idiot. It's FreeBSD not linux. But does that matter for the find command, aren't they the same code on both? I guess maybe not.

%uname -a
FreeBSD _______ 6.2-RELEASE-p1 FreeBSD 6.2-RELEASE-p1 #1: Mon May 7 14:30:09 EDT 2007

this is what it says in the perm section of man:

Code:
-perm [-|+]mode
             The mode may be either symbolic (see chmod(1)) or an octal num-
             ber.  If the mode is symbolic, a starting value of zero is
             assumed and the mode sets or clears permissions without regard to
             the process' file mode creation mask.  If the mode is octal, only
             bits 07777 (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG |
             S_IRWXO) of the file's mode bits participate in the comparison.
             If the mode is preceded by a dash (``-''), this primary evaluates
             to true if at least all of the bits in the mode are set in the
             file's mode bits.  If the mode is preceded by a plus (``+''),
             this primary evaluates to true if any of the bits in the mode are
             set in the file's mode bits.  Otherwise, this primary evaluates
             to true if the bits in the mode exactly match the file's mode
             bits.  Note, the first character of a symbolic mode may not be a
             dash (``-'').
 
Old 03-05-2008, 08:24 PM   #11
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by Rotwang View Post
Oh hell, I feel like an idiot. It's FreeBSD not linux. But does that matter for the find command, aren't they the same code on both? I guess maybe not.
No, not necessarily ... often the versions of tools shipped with
BSD are much closer to the old sysV stuff you also find in Slowaris.

Quote:
Originally Posted by Rotwang View Post
%uname -a
FreeBSD _______ 6.2-RELEASE-p1 FreeBSD 6.2-RELEASE-p1 #1: Mon May 7 14:30:09 EDT 2007

this is what it says in the perm section of man:

Code:
-perm [-|+]mode
             The mode may be either symbolic (see chmod(1)) or an octal num-
             ber.  If the mode is symbolic, a starting value of zero is
             assumed and the mode sets or clears permissions without regard to
             the process' file mode creation mask.  If the mode is octal, only
             bits 07777 (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG |
             S_IRWXO) of the file's mode bits participate in the comparison.
             If the mode is preceded by a dash (``-''), this primary evaluates
             to true if at least all of the bits in the mode are set in the
             file's mode bits.  If the mode is preceded by a plus (``+''),
             this primary evaluates to true if any of the bits in the mode are
             set in the file's mode bits.  Otherwise, this primary evaluates
             to true if the bits in the mode exactly match the file's mode
             bits.  Note, the first character of a symbolic mode may not be a
             dash (``-'').
Well ... try the command I've given you in the first response
from a bash rather than a csh. I don't know how to escape the
! in csh.


Cheers,
Tink
 
Old 03-05-2008, 08:27 PM   #12
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
%bash
Erase set to delete.
$ find \! -perm +004 -ls
usage: find [-H | -L | -P] [-EXdsx] [-f file] [file ...] [expression]
 
Old 03-05-2008, 08:34 PM   #13
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Fudge ... does the man-page for BSDs find mention ANY logical operators?


Cheers,
Tink
 
Old 03-05-2008, 09:33 PM   #14
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Original Poster
Rep: Reputation: 30
I'm not sure... it doesn't look like it. that -perms thing won't help?

Here's a dump of man find:

http://www.megaupload.com/?d=67XH1A20
 
Old 03-05-2008, 10:52 PM   #15
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Can't seem to get a download link. Only semi-pornographic ads?


Cheers,
Tink
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute c++ binaries, "permission denied"... even though permission is 777 SerfurJ Programming 14 02-20-2009 04:50 AM
'permission denied" inspite of right permission flags on network drive anirudhvij Linux - Enterprise 8 05-22-2007 05:57 AM
permission problem - "You don't have permission to access" radone Linux - General 3 07-24-2006 10:23 AM
Where to find info how to calculate permission mode digimike Linux - General 0 12-17-2003 03:32 AM
find : permission denied! katana Linux - General 8 06-05-2001 07:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:03 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration