Do the following:
Add group:
sudo addgroup staffAdd user to group:
sudo adduser mike staffGive group access to folder:
sudo chgrp -R staff /home/ClientsSet permissions on folder:
sudo chmod -R 775 /home/ClientsMake all folders subsequently created inside
/home/Clientsto be owned bygroupstaff:sudo setfacl -dR -m g:staff:rwx /home/Clients
Do the following:
Add group:
sudo addgroup staffAdd user to group:
sudo adduser mike staffGive group access to folder:
sudo chgrp -R staff /home/ClientsSet permissions on folder:
sudo chmod -R 775 /home/ClientsMake all folders subsequently created inside
/home/Clientsto be owned bygroupstaff:sudo setfacl -dR -m g:staff:rwx /home/Clients
I named group of downloaders "dlers" in example. Also change user "joe" enter that group.
sudo groupadd dlers
sudo chgrp dlers /home/Clients
sudo adduser joe dlers
sudo chmod 770 /home/Clients # users not in group dlers cannot vi
Videos
How do I delete a group in Linux?
How do I add a user to a group after creating it?
What is the difference between a system group and a regular group?
Assuming one user will be the user the /home is created for:
-- That user would have ALL Permissions by default, as for the others create the users and then add them to the Original users' GROUP
-- Then make sure the GROUP has 777 permissions
sudo groupadd serviceGroup ## Creates the needed group sudo useradd serviceUser ## Adds the service tech user account sudo usermod -a -G serviceGroup serviceUser ## Adds service Account to the service group sudo chmod -R 777 $serviceGroup ## grants full access to the serviceGroup members sudo chown -R localuser:serviceGroup /home/localuser ## owner stays localuser but anyone in the serviceGroup "group" has access to its full contents
This answer teaches you how to fish.
You want to use the
useradd(oradduseron Debian) command to create theserviceUser.You want to use the
groupadd(oraddgroupon Debian) command to create theserviceGroup.You want to use the
usermod(oradduseron Debian) command to addserviceUseruser to theserviceGroupgroup.You want to use the
chgrpcommand to change the group ofworkingFolder.You want to use the
chmodcommand to change the rights for thegroupto allowread,writeandexecuteaccess.You want to use the
mancommand to get the required detail info to perform the exact actions.Start with the
man mancommand.
Creating a group
sudo addgroup groupname
Adding an existing user into this group
sudo adduser username groupname
Permissions Restriction
See this thread for permissions.
**Creating a group **
we can add the group as below, and also you need to add the group id also.
eg - group name - fpsalph,group id - 10000
groupadd -g 10000 fpsalpha
after that, you can check it by this command.
tail /etc/group
The usermod command will allow you to change a user's primary group, supplementary group or a number of other attributes. The -g switch controls the primary group.
For your other questions...
If you specify a group,
groupname, that does not exist during theuseraddstage, you will receive an error - useradd: unknown group groupnameThe
groupaddcommand creates new groups.The group will remain if you remove all users contained within. You don't necessarily have to remove the empty group.
Create the
hilbertgroup viagroupadd hilbert. Then move David's primary group usingusermod -g hilbert hilbert. (Please note that the firsthilbertis the group name and the secondhilbertis the username. This is important in cases, where you are moving a user to a group with a different name)
You may be complicating things a bit here, though. In many Linux distributions, a simple useradd hilbert will create the user hilbert and a group of the same name as the primary. I would add supplementary groups specified together using the -G switch.
You need to read the man usermod which explains what happens with the various options:
usermod -g hilder hilder
will replace your login group from 'faculty' to 'hilder', as long as the group 'hilder' exists. If it doesn't exist then you first need to create it with groupadd.
When you use the -G option you should also use the -a option to append new groups to the current list of supplementary groups that user 'hilder' belongs. Without the -a option you will replace current supplementary groups with a new group set. Therefore use this cautiously.