Group Membership on Linux – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, user-management, groups, , .
I am adding a user using
useradd -d /home/testuser -m -g usergroup -s /bin/bash testuser
The group ‘usergroup’ already exists. This command runs fine and the user is created. However, when I try to use it to write to a folder that only has group write permission, it says permission denied. When I look in /etc/group , the user is not in the list of users that belong to ‘usergroup’. Is there an extra step I am missing?
forgot to mention that when I add the user to /etc/group, he has the correct access.
uid=524(testuser) gid=524(usergroup) groups=524(usergroup)
drwxrwxr-x site usergroup /usr/local/test/
To add a user to a group IN ADDITION to their “personal” group, you need to use the -G option. This is probably the option you want, otherwise that user’s home directory will be
drwxr-xr-x 2 user usergroup
Unless, of course, you don’t want the user to have any personal stuff at all. If you want the user to write files with the
usergroup group when working on the shared directory, set the sgid bit on the directory (chmod g+s /usr/local/test/), this causes files created in that directory to always have the same group as the directory.