Using find for variable combination of perms


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using find for variable combination of perms
# 1  
Old 07-02-2013
Using find for variable combination of perms

Hi,

I'm trying to use find in kshell (AIX) to find all files with perms of
write for other
AND
any execute bit set.

e.g:
r--r-x-w- would qualify
and rw-rw--wx would qualify
but ---rwxr-xr-x wouldn't qualify

So far, I've been trying something like this:
Code:
find . -type f -perm -o=w -a \( -perm -u=x -o -perm -g=x -o -perm o=x \) -ls

But this is just giving me files with execute bit set anywhere, but not necessarily files with write for other.

Any help much appreciated thanks, Alan.
# 2  
Old 07-02-2013
Can u try this.

Code:
 find . -perm -o=w -a \( -perm -u+x -o -perm -g+x -o -perm -o+x \) -ls


Last edited by Scott; 07-02-2013 at 03:20 AM.. Reason: Please use code tags
# 3  
Old 07-02-2013
Code:
find . -type f \( -perm -102 -o -perm -012 -o -perm -003 \) -ls

# 4  
Old 07-02-2013
Thanks millan and MadeInGermany, I will try those suggestions tomorrow during the day when I'm connected to a UNIX box again.
(It's 9:35pm here in New Zealand right now).

Will let you know how it goes. Cheers, Alan.
# 5  
Old 07-03-2013
Ok, tried both variants suggested above, and, whaddya know, they both worked beautifully.

Code:
> find . -perm -o=w -a \( -perm -u+x -o -perm -g+x -o -perm -o+x \) -ls
   93    1 -rw-----wx  1 alanp     staff            970 Sep  6  2011 ./smit.log
   94    1 -rwx----w-  1 alanp     staff            176 Sep  6  2011 ./smit.script

> find . -type f \( -perm -102 -o -perm -012 -o -perm -003 \) -ls      
   93    1 -rw-----wx  1 alanp     staff            970 Sep  6  2011 ./smit.log
   94    1 -rwx----w-  1 alanp     staff            176 Sep  6  2011 ./smit.script

Not found (correctly) were the below
-rwx------ 1 alanp staff 20023 May 18 2012 sudo_check.sh
-rwx------ 1 alanp staff 92808 Dec 08 2011 extract_global.ksh
-rw-----w- 1 root system 2342 Dec 07 2012 wlghost1.txt
-rw-----w- 1 root system 78765 Mar 24 2009 wlghost1_lpp.txt


Thanks again millan and MadeInGermany.

Alan.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Perms for Unix user

Can you describe how to give privileges to the user in normal use of your folder / home / user To be able to properly use Git and other applications of Python I've done something like chown-R myuser / home / myuser But there were some problems with Git commits.... like link unavailabe and... (3 Replies)
Discussion started by: sandrain
3 Replies

2. Shell Programming and Scripting

Complex find and replace only 1st instance string with dynamic combination

test.txt is the dynamic file but some of combination are fix like below are the lines ;wonder_off = ;wonder_off = disabled wonder_off = wonder_off = disabled the test.txt can content them in any order #cat test.xt ;wonder_off = ;wonder_off = disabled wonder_off = wonder_off =... (5 Replies)
Discussion started by: SilvesterJ
5 Replies

3. Solaris

NFS server RW perms

Hi I can't write to fs "/share/nfs" shared by nfs server despite properly setting RW permissions. NFS server is configured on CentOS and Solaris10 is client. CentOS NFS Server config : -------------------------------- Entries in /etc/exports file : # cat /etc/exports /inst ... (6 Replies)
Discussion started by: presul
6 Replies

4. Programming

Determining file access perms for current process

Stupid question, but is there an ANSI C stdlib function that will do this for me? I want to pass the function a path and determine if the current process can read/write/execute on the path. I suppose I can whip something up using fstat and then determining the current process's user/group IDs and... (6 Replies)
Discussion started by: DreamWarrior
6 Replies

5. Slackware

CUPS setup / dev/lp0 perms. ... Slow printing.

Hello, Ive got an HP LaserJet 2100 / parallel interface. I had some troubles getting going due to non-working cups drivers. Updated cups and also used a .ppd.gz file from something HP provided. found the files here... www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_2100 Anyways.... (1 Reply)
Discussion started by: agentrnge
1 Replies

6. UNIX for Dummies Questions & Answers

Grep and find combination

Hello All, I'm trying the following:find . -name "*" -exec grep -ln "IsAlpha" {} \; It gives me file names only (having string "IsAlpha"), I want to get line numbers also, something like this: test 1: Line 52 test 1: Line 95 etc Is it possible to obtain using grep & find only. (5 Replies)
Discussion started by: nervous
5 Replies

7. UNIX for Dummies Questions & Answers

Combination of find -xargs & wc -l

Dear all, I have to calculate sum of record count of files of the specified directory. First I tried the following way which prints one or more outputs. How can I sum of this output? find /home/work/tmp/1/O/ -type f -print0 | xargs -0 wc -l | grep total 1666288 total 1073908 total ... (4 Replies)
Discussion started by: mr_bold
4 Replies

8. Shell Programming and Scripting

'find' and 'tar' combination

I'm trying to tar the files I get from the 'find' command result. However I can't make it run successfuly? This is for our archiving process. Here is my script: find /mnt/LOGS -mtime -10 -name "TUXLOG.*" -exec tar -cvf /mnt/LOGS/combine.tar {} \; Im not sure why it is not working or it is... (2 Replies)
Discussion started by: kharen11
2 Replies

9. UNIX for Dummies Questions & Answers

Combination Of commands

Hello All, I just wanted to know what are the different ways of using commands in combination. The most common one which i know is using pipes. Also grouping is also done like ( ls; date) where output of both the commands is displayed. Are there any other ways of combining various... (2 Replies)
Discussion started by: rahulrathod
2 Replies

10. UNIX for Advanced & Expert Users

selective tar image and dir perms

Hi, I'm creating a tar image containing selected files held in a manifest file thus: cat <manifest file> | xargs tar -cvpf tar.out I need to preserve the directory as well as the file perms. When my list contains no separate directory lines, the directory is created implicitly when the... (4 Replies)
Discussion started by: gfarley
4 Replies
Login or Register to Ask a Question