LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Group permissions (https://www.linuxquestions.org/questions/linux-newbie-8/group-permissions-4175488185/)

loadedmind 12-16-2013 04:49 PM

Group permissions
 
Hey all. I have a test user account that I've created that has somehow affiliated itself to a group that I didn't associate. I've got a test LDAP environment and I'm ssh'ing into a machine as this user successfully.

I have a group called lusers with a GID of 1001 and another group called users with a GID of 100. Under my /home/testuser/ directory, I see that there are a bunch of directories and files owned by testuser.1001 and I would like to associate them to testuser.100. Is there an easy way to do this versus changing them individually?

Additionally, if I no longer wish to use the lusers group (in order to prevent my other testuser2 and testuser3 accounts from somehow wrongfully associating with it, is there a best practices method to achieve this result?

Many thanks for any/all feedback.

suicidaleggroll 12-16-2013 04:59 PM

Code:

find /home/testuser -group 1001 -exec chgrp 100 {} \;
That will find any files/dirs anywhere in /home/testuser that are currently in group 1001, and change them to group 100.

If you want to prevent a certain user from accessing files in a given group, you would simply remove that user from the group (assuming the permissions on the files had already been set up to keep all users out and only allow the owner and group access).

loadedmind 12-16-2013 09:45 PM

Thanks. I actually found that the -h flag for chgrp works best.

suicidaleggroll 12-16-2013 11:58 PM

The -h flag tells chgrp to change the group of a symbolic link itself rather than the target. How does that help?


All times are GMT -5. The time now is 02:01 AM.