LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-25-2007, 10:33 AM   #1
gizza23
Member
 
Registered: Jun 2005
Location: Chicago, IL, USA
Distribution: Fedora Core, CentOS
Posts: 188

Rep: Reputation: 31
Group Write Problems


Hi All,

I hope that I'm writing something that's new. This seems like a topic that would be well documented, however, I've yet to come across an explanation. Here goes...
I've made a folder. I'm the owner and I want group www to be able to write to it. So, I chmod to 775 on that folder. If a new user is in the www as a secondary group, why is he/she unable to write to the folder? It seems so simple but in all the times that I've tried this I've failed. So I believe that I'm missing something fundamental here. Thank you for your help.
 
Old 07-25-2007, 11:54 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
You are the owner, but to which group does it belong.
Code:
wim@desktop1:~$ ls -l
total 4972
-rw-r--r-- 1 wim wim 1249888 2007-06-16 12:08 20070616_120821_P6161254.jpg
-rw-r--r-- 1 wim wim 1364406 2007-06-16 12:09 20070616_120909_P6161255.jpg
-rw-r--r-- 1 wim wim 1250968 2007-06-16 12:09 20070616_120941_P6161256.jpg
-rw-r--r-- 1 wim wim 1186222 2007-06-16 12:11 20070616_121101_P6161257.jpg
-rw-r--r-- 1 wim wim    1706 2007-03-21 18:26 automatix2.key
drwxr-xr-x 2 wim wim    4096 2007-07-17 21:30 Desktop
lrwxrwxrwx 1 wim wim      26 2007-07-17 14:26 Examples -> /usr/share/example-content
drwxr-xr-x 2 wim wim    4096 2007-07-25 18:47 newdir
wim@desktop1:~$
Changing to 775 will not help in this case as the group www will fall under others (marked in red). You can either use 757 for the permissions, but that will allow everybody to write there. So it will be better to change the group ownership of the directory to www:
Code:
chgrp www newdir

Last edited by Wim Sturkenboom; 07-25-2007 at 11:55 AM.
 
Old 07-25-2007, 02:16 PM   #3
gizza23
Member
 
Registered: Jun 2005
Location: Chicago, IL, USA
Distribution: Fedora Core, CentOS
Posts: 188

Original Poster
Rep: Reputation: 31
Wow, that was right on the money! chgrp worked just fine. I didn't include something very important in my description though. I had been using chown to make www the owning group of that folder. However, using chgrp did the trick. I wonder whats the difference between using chown and chgrp other than a regular user can use chgrp. Thanks!
 
Old 07-25-2007, 10:33 PM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
It should work with chown as well
Code:
chown wim:www newdir
 
Old 07-27-2007, 11:53 AM   #5
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Rep: Reputation: 32
Lightbulb Owner and Group Permissions -- CHOWN

chown lets you change both "OWNER" and "GROUP" where as chgrp just changes the group....

chown win:www /home/win/test_file.txt changes the owner and the group for the file test_file.txt in the home directory of the user win
so if you want to change the group from www to dev_01 you would say, thus keeping the owner as win but allowing the group dev_01 to have access:
chown win:dev_01 /home/win/test_file.txt

chgrp changes just the group factor....

something i learned when changing the group permissions is that you also have to change the permission on the file. an example is when you use samba. lets say and in my case i had permissions on the file user_and_group_list.txt as 744 and wanted to allow all system users to be able to edit it i would have to make it 760 for the permission so that the group can access it. you see the permissions on a file are OWNER|GROUP|PUBLIC. so if i have 777 anyone and everyone can read/write/execute this file - which i dont want. i just wanted the group to be able to access this file and make chances but allow the public to do nothing with the file.

Check out this UNIX File Permissions Tutorial for more information. This should help a lot with any permission problems you may have or may encounter in the future!

Good luck and have fun! Hopefully this little blurb helps you to understand the permissions and ownership a little better and I hope I have not confused you in anyway....

Last edited by bskrakes; 07-27-2007 at 11:56 AM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vi changing owner and group on a force write fukawi2 Linux - Security 9 11-05-2020 12:49 PM
How to mount ntfs partition so a group can write to it? greengrocer Linux - Newbie 3 10-23-2005 12:26 AM
Group Admin, Group Root, or God over Group crickett Linux - General 5 07-12-2004 04:01 PM
Write access for group / other Cubsy Linux - Software 2 11-06-2003 12:03 PM
vfat partition - write permission for users group digitized_funk Linux - Newbie 8 03-19-2003 07:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration