Samba shares grant access to all users: permissions not working

I'm using Samba to create protected shares on Ubuntu Server that should be accessible by Windows computers. It does prompt me for a user name & password but one login grants access to all files, even those made for other users. What am I doing wrong here?

So basically

su
cd
mkdir /files
mkdir /files/user1
mkdir /files/user2
mkdir /files/user3
chmod 777 /files/user1
chmod 777 /files/user2
chmod 777 /files/user3
vi /etc/samba/smb.conf

Under [global] I add:

security = user
wins support = yes
name resolve order = lmhosts host wins bcast

At the bottom:

[User1's files]
comment = User1's Files
path = /files/user1
browseable = yes
read only = no
valid user = user1
[User2's files]
comment = User2's Files
path = /files/user2
browseable = yes
read only = no
valid user = user2

And the same for user 3.

shutdown -r now

Now on the Windows PC logged in as user1 I try to access user2. It prompts me for a username & password. I enter the details for user1 and it grants me access, but it shouldn't do. It then also grants me access to user3. What am I doing wrong?

I tried adding

force user = user1
create mask = 0640
directory mask = 0750

but this didn't help.

The user accounts are on both Windows & the server.

1 Answer

You can try the invalid user option on each share, or consider exporting their home folders.

Are you using a single Windows computer with multiple users?

  • change world permissions - chmod 0770
  • change the ownership of users sub-folder - chown user:*

useful links:

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like