I want to share folder for myself and another user with samba. I have created smb.conf like this:

        workgroup = WORKGROUP
        server role = standalone server
        map to guest = never
        usershare allow guests = no 
        hosts allow =
        hosts deny =

        comment = share of movies in local network
        path = /media/user1/multimedia/video/movies-library
        browseable = yes
        writeable = yes
        valid users = user1,user2

user1 is me and I can access to this share and see everything and I can write so it works fine, but user2 can only log in, everything else is not accessible, even reading files. My question is how to make it readable and writable for user2? I assume that this could be related with permissions to access movies-library folder for user2. I'm not sure how should I assign proper permissions or group.

1 Answer 1


Your two users are by default in their own groups: user1:user1 and user2:user2.

The files are likely owned by user1:user1 with no access to 'other' users.

Solutions range from simplest to most robust:

  1. Pretend everyone is user1 by adding force user = user1 to the share.
  • user2 now has all the rights and permissions that user1 has.
  • As per @DeeJayh's comment, you will also want to add valid users = user1 user2 so that user3 and 4, etc cannot browse the share.
  1. Pretend everyone is group user1 by adding force group = user1 to the share.
  • Same caveat as above but you can remove group write access with chmod g-w ...
  1. Grant EVERYONE read/execute access.
  • This including user2
  • Everyone on the system will have access to the files as they exist now, though not via samba.
  • Future additions will need this run each time.
  • chmod -R o+rx /media/user1/multimedia/video/movies-library
  1. Share group
  • Create a group that user1 and user2 are both members of and set ownership of the files to that group.
  • Add that group to both users.
  • Set the group ownership of the share to that group.
  • Make sure everything in that directory is group accessible.
  • SetGID on the directory so future additions inherit the group.

sudo usermod -a -G media-share user1 sudo usermod -a -G media-share user2 chown -R user1:media-share /media/user1/multimedia/video/movies-library chmod -R g+rx /media/user1/multimedia/video/movies-library chmod -R g+s /media/user1/multimedia/video/movies-library```

  • If you add files via samba then you can set the directory and file mask to ensure group permissions by adding create mask = 0750 and directory mask = 0770 to the share.
  • I chose option 1. and it works perfectly in this situation :) Thanks for making this guide I will use other options in future for sure. May 22, 2019 at 21:49
  • 1
    Upvoted due to the answer being "helpful" to others, but if you have a moment, you should definitely explain the valid users method to just allow the user(s) or @group(s) that you specifically want. I don't think the question will benefit from another answer addressing just this.
    – DeeJayh
    May 7, 2021 at 3:33
  • hey, you can't imagine how much I love you at this moment :D I understood from many places I read it that force user and force group only were defining the owner and group for new files until I read your line "Pretend everyone is user1..." I commented that option and chose option 4 for success. Thank you man!
    – Olvathar
    May 13, 2022 at 1:05

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.