Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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!
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251
Rep:
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....
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.