I have a user user1 that belongs to group1 as primary group, but I need this user to have read/write access to a folder that belongs to group2.

I tried adding a secondary group to this user so it now belongs to group1 as primary group and group2 as secondary group but I still don't have access to the folder.

I used this command to add the primary group usermod -g group1 user1 and this one to add the secondary group usermod -a -G group2 user1

This are my folders permissions:

drwxr-xr-x  8 owner  group1     4096 jun  5 10:26 ./
drwxr-xr-x  6 owner  owner      4096 jun  5 10:03 ../
drwxrwx--- 14 owner  group1     4096 jun  5 11:12 folder1
drwxrwx---  5 owner  group1     4096 may 24 11:32 folder2
drwxrwx--- 13 owner  group2     4096 jun  5 10:29 folder3
drwxrwx---  3 owner  group2     4096 jun  5 10:26 folder4
drwxrwx---  8 owner  group2     4096 jun  5 10:25 folder5
drwxrwx---  6 owner  group1     4096 jun  2 09:19 folder6

Can you help me solve this problem please?


If I understand correctly (but it's confusing) I think you've to approach this the other way around. If I understand you correctly you tried to add a group to an user. What would work is adding the user to a group. If you want user1 to have access to folders/ files of group 2, do:

sudo adduser user1 group2

  • Wow, I really didn't make my self clear, i'm sorry what i'm trying to do is give permissions to one single user with two different groups. – Mateo Guty Jun 5 '18 at 22:52

Thanks to KamilMaciorowski for the answer I need to modify the smb.conf file and add the new group in order to be able to have access.

I modify it this way:

    browsable = yes
    path = smb/dir
    guest ok = no
    guest only = no
    create mask = 0770
    directory mask = 0770
    write list = @group1, @group2
    read list =
    valid users = @group1, @group2
    read only = no

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.