Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Permissions for different groups.
How could I set different permissions for different users and groups for the same file? Now what I see that we can only set permissions for the one user and one group For example in Windows we are able to set any kind of permissions for any number of users for the same file or folder. What is the solution for that in Linux?
To meet your requirement, what I thought is ACL(Access Control Lists). This provides additional permission mechanism for file systems and allows you to give permissions for any user or group to any disc resource.
-rw-r----- 1 treehouse treehouse 342 Jul 25 00:03 hello.txt
For instance, we have one file named hello.txt. The owner of this file is "treehouse" which belongs to group "treehouse" as well. The group "treehouse" also has other users like "test1", "test2".
- The owner "treehouse" has read and write permissions(-rw-r-----) for hello.txt.
- "test1" and "test2" belong to group "treehouse" only have read permission(-rw-r-----) for hello.txt.
- Other users which are not "treehouse", "test1" and "test2" don't have any permissions (-rw-r-----) for hello.txt
Hope this helps.
The precondition is the owner of this file is treehosue and treehouse belongs to treehosue group for "hello.txt". And then you introduced a new group treebears.
May I know your assumption?
- Does the owner user treehouse belong to treebears?
- Or treebears is just an independent group, which doesn't have any relationship with owner treehouse?