Welcome to the most active Linux Forum on the web.
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 11-19-2004, 06:15 AM   #1
Registered: Nov 2003
Distribution: Arch
Posts: 136

Rep: Reputation: 21
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?

Old 11-19-2004, 07:01 AM   #2
Registered: Aug 2004
Location: Israel
Distribution: Ubuntu 10.10
Posts: 271

Rep: Reputation: 34
chmod -R g+s dir1
-R is recursive.
man chmod
is the best way to understand it.
Old 11-19-2004, 07:02 AM   #3
LQ Newbie
Registered: Aug 2003
Location: Australia
Distribution: Fedora Core 2
Posts: 24

Rep: Reputation: 15
AFAIK, 's' is for *new* files created in that dir. If you want to change existing files, use -R like the other poster said.
Old 11-19-2004, 08:38 AM   #4
Registered: Nov 2003
Distribution: Arch
Posts: 136

Original Poster
Rep: Reputation: 21
Thank you.
Old 11-19-2004, 04:27 PM   #5
LQ Newbie
Registered: Oct 2004
Location: Lillian, Alabama , USA
Distribution: mepis8, debian lenny
Posts: 23

Rep: Reputation: 15
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.


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
chmod/chown and folders :) chibi Linux - Newbie 2 04-28-2005 05:56 PM
Chown & Chmod swatward Linux - Newbie 2 03-01-2005 01:57 PM
chmod ,chown ,chgrp------------ pal Linux - Newbie 1 02-27-2005 03:49 PM
Log Chmod and Chown FernandoLozano Linux - Security 5 01-10-2005 10:01 AM
reverse chmod/chown changes demmylls Linux - General 1 02-09-2004 01:16 AM > Forums > Linux Forums > Linux - Newbie

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