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 01-10-2005, 09:18 PM   #1
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Rep: Reputation: 30
chmod command to change all files in directory

i'm wondering if there is a chmod command to give access to all the files and subdirectories in a directory to all users?
Old 01-10-2005, 09:54 PM   #2
Registered: Aug 2002
Location: MN USA
Distribution: slakware 9.0
Posts: 121

Rep: Reputation: 15
man chmod
-R Recusively change permissions of directories and their contents
Old 01-10-2005, 10:05 PM   #3
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 658Reputation: 658Reputation: 658Reputation: 658Reputation: 658Reputation: 658
Enable the 'other' bits for the directories and files.

chmod -R o+rwx <target directory>

This command will give all users full access. You might consider using rw access for files and not enabling the executable bit. You do need the executable bit enabled for directories. The 'x' bit is overloaded. For directories, it allows one to enter the directory.

You could do it this way:
find <target-directory> -type f -exec chmod o+rwx "{}" \;
find <target-directory> -type d -exec chmod o+rwx "{}" \;

If the directory is a partition with the fat32 filesystem, then you need to change the permissions in the /etc/fstab entry, by using the fmask and dmask options. For example 'fmask=001,dmask=000,noexec' will give read/write access to everyone, but not allow execution of files contained in the filesystem.


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
Using chmod to recursively change directories / files [GOD]Anck Linux - Software 6 11-10-2008 07:16 PM
Change directory command gizmobay Linux - Newbie 4 11-23-2005 07:11 PM
Why doesn't a wildcard chmod change "dot" files/directories? jht2k Linux - General 1 08-09-2004 03:31 PM
chmod command not affecting files blueleft Linux - General 4 08-09-2003 12:26 PM
RH 8.0 don't let me change attrib by chmod command explorer1979 Linux - General 2 10-27-2002 12:29 PM

All times are GMT -5. The time now is 05:59 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