How to give different permissions to multiple groups of users?

I installed Ubuntu 12.04 server and want to give full folder access say example: "Folder01" to group "Group01' and Limit "Group02" for read access only. How I can do this.


Solution 1:

If you want to restrict access to only two groups say Group01 full access and Group02 having only read only access, In this case you can use file access control list (ACL). (In your case I think itis the best solution)

setfacl -R -m g:Group01:rwx Folder01
setfacl -R -m g:Group02:r-- Folder01

You can verify changes via getfacl Folder01.And you can remove all permissions for others like this chmod -R o-rwx Folder01

So by this you folder is only accessible via Group01 ( full access ) and Group02 (read only access) and no doubt owner of that folder can also access that folder.