The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
user & group read/write access question Katkota UNIX for Dummies Questions & Answers 3 08-28-2008 09:30 PM
group & user permission question Katkota UNIX for Dummies Questions & Answers 10 08-14-2008 02:37 PM
Newly created files default group and write permissions goldfish UNIX for Dummies Questions & Answers 2 02-20-2008 06:39 PM
how to read or write device files sriram.ec UNIX for Dummies Questions & Answers 1 01-03-2006 05:27 PM
Script with read/write Files steiner Shell Programming and Scripting 5 07-25-2003 10:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-20-2008
shunter63 shunter63 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 5
Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission.

This is what I have so far:
find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}'

It shows me all files where group read = true, group write = true and and user write = true.

how do I make it show me where group read = true, OR group write = true OR user write = true?

Thanks!
  #2 (permalink)  
Old 10-20-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
Code:
 find . \( -perm -g=r -o -perm -g=w -o -perm -u=w \) -ls
  #3 (permalink)  
Old 10-20-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink One thought...

Three finds
'/-...r...../ {
'/-....w..../ {
'/-.......w./ {

all to a workfile, then so a | sort -u (in case of duplicates)
  #4 (permalink)  
Old 10-20-2008
pvamsikr pvamsikr is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 16
you can use this one.. may be u need to modify some part


ll | tr -s ' ' | awk '{ perm=$1; dd=substr(perm,2,3); de=substr(perm,5,3); if (dd == "rw-" && de == "r--" ) print $9 }'
  #5 (permalink)  
Old 10-23-2008
shunter63 shunter63 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 5
I decided I didnt want to see anythink that was a link ( only files and directories).
I also wanted it sorted by the directory name which I put in the 4th column of my output file.
Here is what I ended up with:

find . -type d \( -perm -g=w -o -perm -o=r -o -perm -o=w \) -ls | awk '{print $3 " " $5 " " $6 " " $11}' > /home/shunter/findperm.tmp

find . -type f \( -perm -g=w -o -perm -o=r -o -perm -o=w \) -ls | awk '{print $3 " " $5 " " $6 " " $11}' >> /home/shunter/findperm.tmp

cat /home/shunter/findperm.tmp | sort -k4 > /home/shunter/findperm.txt
rm /home/shunter/findperm.tmp


Thanks for your help!
  #6 (permalink)  
Old 01-14-2009
jrogersmith jrogersmith is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
I believe this will work too.

find . -perm +260

+ perms will use the 'or' operator.
2 user write,
6 group read or write
0 no special conditions for others.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0