LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   chmod help (https://www.linuxquestions.org/questions/linux-newbie-8/chmod-help-911160/)

damgar 10-31-2011 06:33 PM

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
Code:

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?

markush 10-31-2011 06:37 PM

Hi,

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.

Markus

eSelix 10-31-2011 06:38 PM

If you want to traverse subdirectories you need something like
Code:

chmod -R u=rwX,go=rX /foo/bar
Capital "X" means: permision "x" only for directories.

oneyou 11-02-2011 07:53 PM

Hi

-rw-r--r--
user.group.all

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


All times are GMT -5. The time now is 10:21 AM.