Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-11-2009, 07:00 AM   #1
LQ Newbie
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
find files which does not have 770 permissions

I need a script which can throw an error if there are files in a directory which does not have permissions of 770. this should include directores which may contain empty folders.

If there are files which dont have the permission 770 ..the script need to throw an error..

Please can someone help.
Old 10-11-2009, 08:30 AM   #2
Senior Member
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hi zrux and wellcome to LQ,

the find-command should work for you. Look at man find and especially for the -perm option.
find . -perm 770 -print
will find all files with this permissions. You'll have to find out then which files are not printed by the above command.
Another way to make sure that all permissions within a directory are equal to 770 would be to use chmod with the -R option (look at man chmod).


Last edited by markush; 10-11-2009 at 08:33 AM.
Old 10-11-2009, 02:17 PM   #3
LQ Newbie
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
thanks very much

But how do I find those files which are not printed by the above command?
Old 10-11-2009, 02:28 PM   #4
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913
find . -type f -perm /o=x -ls

Last edited by Tinkster; 10-11-2009 at 02:49 PM. Reason: fix-up
Old 10-11-2009, 04:13 PM   #5
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,511

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Try this:

find <path> -perm 770 > 770.txt
find <path> > all.txt
diff -d all.txt 770.txt > diff.txt

And then read diff.txt


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 06:55 PM
Permissions error while copying files on NFS, but only on some files caggles Linux - Networking 1 07-30-2009 04:17 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 05:45 PM
Is there a way to find recently created/edited files without using find? BrianK Linux - General 2 10-15-2007 10:41 PM
how to change exisitng files/directory permission from 755 to 770 mweil Linux - Newbie 3 07-01-2004 11:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration