Puzzel Soalris command structure

Posted on 2011-10-26
Last Modified: 2012-05-12
Hi All,

   I have a problem, a real puzzle!!

     This has to do with the FIND command specifically on SOLARIS.   Normally I could use alternatives
Like the GNU find or find2perl but in this case I have specific constraint I have to stay with the native
SUN find command

 Here is the problem:     this is a basic find command to look for world writable file and  excluding some dir
From the search path.  The problem with this is that if someone creates a file or dir like  /opt/dev it will also be exclude
And we don’t want that.  To add to the problem this will be run on over 1000 servers within another app

So anyone has idea on how I could build this command.

 find  / -name /proc -prune \
     -o -name /sys -prune \
     -o -name /dev -prune \
     -o -name /devices -prune \
     -o -perm -2 ! -type l  ! -type s \
     ! \( -type d -perm -1000 \) -ls
Question by:d_asselin
    LVL 31

    Assisted Solution

    Try this
    find  /proc /sys /dev-name /proc devices -perm -2 -not -type l  -not -type s -not -type d -not -perm 1000

    Open in new window

    LVL 31

    Assisted Solution

    Sorry this one.  Let me know.
    find  /proc /sys /dev /proc devices -perm -2 -not -type l  -not -type s -not -type d -not -perm 1000

    Open in new window

    LVL 31

    Assisted Solution

    Typo again
    find  /proc /sys /dev /proc /devices -perm -2 -not -type l  -not -type s -not -type d -not -perm 1000

    Open in new window


    Assisted Solution

      I don’t think so.  Solaris doesn’t support  the –not.
    Nice try I had never seen the –not option in a find command

    find  /proc /sys /dev /proc /devices -perm -2 -not -type l  -not -type s -not -type d -not -perm 1000
    find: bad option -not
    find: [-H | -L] path-list predicate-list
    [08:46 0.04]
    LVL 31

    Assisted Solution

    Then use ! instead of -not.  Does that work?

    Accepted Solution

    Ok let’s get back to the scope of the questions.

     I need to scan 1400 Solaris servers of different flavors Sol 8 9 10  So I<m very very limited
    On the tools I can use.

    So the Native Sun tool is all I have.   The Scan has to scan all of the file systems excluding
    Some system dir like /dev ,  /devices. The standard find will do that with no problem.   But
    What the standard find will not do is discriminate between  /dev  and /opt/dev if some one
    Created it.  Because the function –path is not supported in that version of find

    I hope this helps explain what I’m looking for, I’m not even shure it is possible

    Author Closing Comment

    No good answers are possible

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now