find / -perm -4000

find / -perm -4000

Post by pnob.. » Thu, 10 Dec 1998 04:00:00



Hi,

i was wondering...

to find the setuid you use find / -perm 4000
to find the setguid you use find / -perm 2000

However, where do these 4000 and 2000 come from?
They are supposed to be octal numbers.

4000 binary is 100000000000
                       -rwxrwxrwx

This doens't match the permissions...  Can someone please explain...?

 
 
 

find / -perm -4000

Post by Frank Sweetse » Thu, 10 Dec 1998 04:00:00



> Hi,

> i was wondering...

> to find the setuid you use find / -perm 4000
> to find the setguid you use find / -perm 2000

> However, where do these 4000 and 2000 come from?
> They are supposed to be octal numbers.

> 4000 binary is 100000000000
>                        -rwxrwxrwx

> This doens't match the permissions...  Can someone please explain...?

the low 9 bits are used for the rwx perms for user group and other.  the
bits above that are used for the sticky bit, setuid, and setgid.  

--
Frank Sweetser rasmusin at wpi.edu fsweetser at blee.net  | PGP key available
paramount.ind.wpi.edu RedHat 5.2 kernel 2.1.129      i586 | at public servers
Avoid the Gates of Hell.  Use Linux
(Unknown source)

 
 
 

find / -perm -4000

Post by Roland Latou » Thu, 10 Dec 1998 04:00:00



> to find the setuid you use find / -perm 4000
> to find the setguid you use find / -perm 2000

> However, where do these 4000 and 2000 come from?
> They are supposed to be octal numbers.

> 4000 binary is 100000000000
>                        -rwxrwxrwx

4000 octal = 100 000 000 000
First triplet: SUID, SGID, sticky bit
Second triplet: rwx for owner
Third triplet: rwx for group
Fourth triplet: rwx for others              

Quote:> This doens't match the permissions...  Can someone please explain...?

--
  Roland Latour  Slackware3.4 & PPP     http://home.cdsnet.net/~rolandl
      Change is inevitable, except from a vending machine.
 
 
 

1. Subject: Confusion re. "find -perm ..."

Hello,

I'm running into behaviour which I don't understand using
"find" on solaris 8 (sun box).  I want to find the files and
directories for which "group" and "other" do not have read
permission:

   find .  \! -perm -go+r -exec ls -l {} \;

This turned up files, some of which "group" and "other" have
read permissions to.  This wasn't what I was expecting.  As
a sanity check, I tried the opoosite (finding files for
which "group" and "other" *have* read access):

   find . -perm -go+r -exec ls -l {} \;

This turns up some files for which "group" and "other" do
*not* have read permission e.g.:

   drwx------   2 fma      students     512 Mar  3 06:25 BuildLogs
   -r--------   1 fma      students     407 Apr  5  2002 ChangeLog

Here are the selected man page sentences from which I got my
[mis]understanding of the -perm "primary":

     -perm [-]mode

           The mode argument is used to represent file mode bits.
           <<...SNIP...>>
           To start, a template will be assumed with
           all file mode bits cleared.  An op symbol of:

           +     will set the appropriate mode bits in  the  tem-
                 plate;

           <<...SNIP...>>
           if mode is prefixed by a hyphen,  the  pri-
           mary will evaluate as true if at least all the bits in
           the resulting template are set in the file  permission
           bits.

Could someone more experienced than I please point out how
my "find" expression departs from the man page in finding
files for which "group" and "other" do (or do not) have read
permission?  Thanks.

Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6

2. linux and w95 networking

3. suppressing 'no perm' msg in find

4. Phone numbers

5. How to 'find -perm' for *unset* modes?

6. kernel rebuild questionns

7. Need to find vi command to remove ^H from command man find > find.txt

8. Q:writing a GUI interface

9. find without the "find: cannot read dir /usr/lost+found: Permission denied"

10. find, find, find

11. Urgent contract & Perm UK Jobs for Solaris Specialists

12. nfs, client side mounting error, no perm's from server

13. Looking for for-hire sysadmin (non-perm, job-by-job basis)