Download your favorite Linux distribution at LQ ISO.
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-31-2011, 07:33 PM   #1
Senior Member
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
chmod help

I have a large directory with about 60GB worth of subdirectories and files beneath it. I would like only root to have access to delete anything in that directory, while any user can read the files (say mp3's and I want any user to be able to play them). I keep thinking
chmod -R 644 /foo/bar
would give me read access to the files as a regular user, but it does not.

Since the directory in question is a subdirectory, do I need to give the same permissions all the way up the tree? is that where I'm making my mistake?
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-31-2011, 07:37 PM   #2
Senior Member
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,976

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850

your mistake is that a directory must be executable in order to access it. You'll have to give 644 to all files but 755 to all directories.

3 members found this post helpful.
Old 10-31-2011, 07:38 PM   #3
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,248

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
If you want to traverse subdirectories you need something like
chmod -R u=rwX,go=rX /foo/bar
Capital "X" means: permision "x" only for directories.
6 members found this post helpful.
Old 11-02-2011, 08:53 PM   #4
LQ Newbie
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled


First you need to changed the owner to root

chown -R root.root /foo/bar

then remove write access of other user

chmod -R 745 /foo/bar
7 means only root can read write or execute
4 groups can only read
5 all user can read and execute

I hope that will help


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
Sticky Bit? (ie: chmod 2770 vs chmod 770) JeffC1 Linux - Newbie 7 03-18-2010 08:39 AM
Apache: difference between chmod 644 and chmod 666 and chmod 600 for output/txt/dat? frenchn00b Programming 6 04-22-2009 02:10 PM
chmod 775 to only the directories and chmod 664 to only the files? apachenew Linux - Security 6 09-27-2007 04:26 PM
chmod, external usb, vfat - can't chmod a directory itsjustme Slackware 2 04-02-2006 05:23 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 06:37 AM

All times are GMT -5. The time now is 01:57 AM.

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