0

I have created group (lets call this user admin):

sudo groupadd mygroup

switched to user test (from admin user):

sudo su - test
cd /home/test/
mkdir external
exit
cd /home/test/
sudo chgrp -R mygroup external
sudo usermod -a -G mygroup admin
sudo usermod -a -G mygroup test
sudo chmod -R g=rwx external

Now I do this:

cd external
mkdir something
mkdir: cannot create directory ‘something’: Permission denied

So how can I make that everyone that has mygroup would have all access like the owner does? So I could create inside external directory any other directory or file, delete it and so on (without using sudo).

P.S.

ls -l:
drwxrwxr-x 2 test mygroup 4096 Spa 15 16:24 external
getent group mygroup:
ambulance:x:1002:admin,test
Andrius
  • 19,658
  • 37
  • 143
  • 243

1 Answers1

1
sudo groupadd mygroup
mkdir external
sudo chown -R root:mygroup external
sudo chmod -R 'g+w' external
sudo chmod -R 'g+s' external
Claudio
  • 10,614
  • 4
  • 31
  • 71
  • Thanks. It seems to be working (only needed to change in chown user to be `admin`. The only thing I don't understand, why do I need to change user too? When I change it, then both `admin` and `test` have all access, but if `test` is owner, then only him has all access even though both are in `mygroup`. – Andrius Oct 15 '14 at 13:46
  • You can skip changing the user and change only the group. The important part is the 'g+s'. If it solved the problem, remember to accept the answer. – Claudio Oct 15 '14 at 13:50
  • Yes it solved, but actually if I use `sudo chgrp -R mygroup external` instead of `sudo chown -R admin:mygroup external`, then I still can't do anything in that directory. So thats why I was asking it. Only if I change both owner and group it gives both users all access for some reason. – Andrius Oct 15 '14 at 13:55