Finding Writable Files

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

I can find files writable by group using this

BASH Code: [ Select ]
find . -perm -g=w


I can find files writable by other or writable by all using this

BASH Code: [ Select ]
find . -perm -o=w


How can I combine the two into one command, and can I have it ignore symlinks ?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Don2007
  • Web Master
  • Web Master
  • Don2007
  • Posts: 4924
  • Loc: NY

Post 3+ Months Ago

http://linux.about.com/od/commands/a/blcmdl1_findx.htm

find . -perm /o=w,g=w

find . -perm /o+w,g+w

It could be something like that but I don't know about eliminating sym links.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

That first one looks about right. Using the -L flag so that find follows the link and examines the permissions of the target instead of the symlink itself seems like it will work for the symlink part.

BASH Code: [ Select ]
find -L . -perm /g=w,o=w


Code: [ Select ]
    -L   Follow symbolic links. When find examines or prints information
       about files, the information used shall be taken from the prop‐
       erties of the file to which the link points, not from the link
       itself (unless it is a broken symbolic link or find is unable to
       examine the file to which the link points). Use of this option
       implies -noleaf. If you later use the -P option, -noleaf will
       still be in effect.  If -L is in effect and find discovers a
       symbolic link to a subdirectory during its search, the subdirec‐
       tory pointed to by the symbolic link will be searched.

       When the -L option is in effect, the -type predicate will always
       match against the type of the file that a symbolic link points
       to rather than the link itself (unless the symbolic link is bro‐
       ken). Using -L causes the -lname and -ilname predicates always
       to return false.
  1.     -L   Follow symbolic links. When find examines or prints information
  2.        about files, the information used shall be taken from the prop‐
  3.        erties of the file to which the link points, not from the link
  4.        itself (unless it is a broken symbolic link or find is unable to
  5.        examine the file to which the link points). Use of this option
  6.        implies -noleaf. If you later use the -P option, -noleaf will
  7.        still be in effect.  If -L is in effect and find discovers a
  8.        symbolic link to a subdirectory during its search, the subdirec‐
  9.        tory pointed to by the symbolic link will be searched.
  10.        When the -L option is in effect, the -type predicate will always
  11.        match against the type of the file that a symbolic link points
  12.        to rather than the link itself (unless the symbolic link is bro‐
  13.        ken). Using -L causes the -lname and -ilname predicates always
  14.        to return false.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 32 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.