LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Understanding chmod, chown (https://www.linuxquestions.org/questions/linux-newbie-8/understanding-chmod-chown-256778/)

mikemrh9 11-19-2004 05:15 AM

Understanding chmod, chown
 
Hi. I'm currently trying to get my head around file permissions.

As I understand it, if I apply 'chmod g+rs' to a directory, what should happen is that 'r' allows the group to read all files in the directory and 's' allows the group to access the contents of the directory, like 'x'. This bit is fine. However, 's' is also supposed to force all files in the directory to the same group as the directory, which is the bit giving me trouble.

I created a directory, dir1, and put some files into it (file1, file2 etc). I changed the ownership of the files with chown :group1 *

At this point, the ownership of dir1 is user1, users. The ownership of all files in the directory is user1, group1.

If I now do chmod g+s dir1, the group permissions to dir1 are changed to r-s, but the files in dir1 are unaffected. I assume I have misunderstood the phrase, ' force all files in the directory to the same group as the directory'.

What is it that 's' does when applied to a directory for a group?

Mike.

z-vet 11-19-2004 06:01 AM

Try
Code:

chmod -R g+s dir1
-R is recursive.
Code:

man chmod
is the best way to understand it.

Nightblade_oz 11-19-2004 06:02 AM

AFAIK, 's' is for *new* files created in that dir. If you want to change existing files, use -R like the other poster said.

mikemrh9 11-19-2004 07:38 AM

Thank you.

rockets 11-19-2004 03:27 PM

Here is a link for a turorial on chmod. I made a linux utilities directory in my home dir and downloaded it so I can practice without damage.

http://catcode.com/teachmod/index.html


All times are GMT -5. The time now is 11:34 AM.