LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-28-2004, 06:05 PM   #1
stateq2
Member
 
Registered: May 2003
Location: US
Distribution: Ubuntu
Posts: 30

Rep: Reputation: 15
Unhappy chmod.....recursive help [SOLVED]


Ok, I've searched here, but I haven't come up w/ any conclusive answers yet. Here's the situation....I want to recursively make some files non-executable. Everytime I attempt it, the directory's permissions get changed too....which makes the directory unaccessible. check it out.....
Code:
stateq2@courage digi_cam $ chmod -R u=rw vids/
chmod: `vids/': Permission denied
now, the directory has the correct permissions BEFORE i run this command....but as it's ran, the permissions get changed (hence the "permission denied" error). from the chmod man page, my understanding, is that the '-R' option is supposed to recursively change the permissions of files that are located in 'vids/". this might be a brainfart question, but i just want to know how to properly set permissions of files in folders, within folders (recursively)...thanks.

Last edited by stateq2; 03-28-2004 at 07:38 PM.
 
Old 03-28-2004, 06:50 PM   #2
stateq2
Member
 
Registered: May 2003
Location: US
Distribution: Ubuntu
Posts: 30

Original Poster
Rep: Reputation: 15
i found a way around the current problem...although i still beleive there is a better way(by using the '-R' option).

i just did
Code:
chmod 755 vids/
.....then
Code:
chmod a-x vids/*.avi
 
Old 03-28-2004, 06:58 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Again, find in combination with chmod would
be a good idea ... you can for instance do

find /<start dir> -type f -exec chmod a-x,u=rw,go+r {} \;

which will leave the permissions of subdirectories
unharmed....

If it's really only avi files you want to change,

find /<start dir> -iname "*.avi" -exec chmod a-x,u=rw,go+r {} \;



Cheers,
Tink
 
Old 03-28-2004, 07:28 PM   #4
stateq2
Member
 
Registered: May 2003
Location: US
Distribution: Ubuntu
Posts: 30

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Tinkster
Again, find in combination with chmod would
be a good idea ... you can for instance do

find /<start dir> -type f -exec chmod a-x,u=rw,go+r {} \;

which will leave the permissions of subdirectories
unharmed....

If it's really only avi files you want to change,

find /<start dir> -iname "*.avi" -exec chmod a-x,u=rw,go+r {} \;



Cheers,
Tink
brilliant! works like a charm...thanks
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] FTP: recursive chmod (separate for directories and files) mgmax Linux - Software 11 01-29-2011 08:06 AM
Help with a recursive chmod script in bash lowpro2k3 Programming 11 07-25-2005 07:03 PM
chmod recursive on files on dlublink Linux - Newbie 6 03-02-2005 08:45 AM
recursive yet selective chmod bluefire Linux - General 6 10-22-2004 06:25 PM
Messed up recursive with chmod Cyth Linux - General 4 01-03-2003 12:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:50 PM.

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