Force Samba to Require Credentials from Windows Client

8,625

I can think of one scenario where this could happen:

[1] You created a user on your samba server named: luca

[2] That user name also exists on Windows.

[3] You made the samba password for luca match the login password for luca on the Windows box.

Windows smb clients always pass the current users login user name and password when they access a server - it does this automatically. It's not that your share didn't require credentials it's that they were passed and accepted already.

The second part of the question about edit permissions - change your share definition to this:

[xshare]
      comment = X's Samba Share
      path = /home/x/share
      read only = no
      browsable = yes
      valid users = x, luca
      force user = x

The share will allow access to x and luca only but once they are in everything they do will be as user x - for that share. Note: I removed the "security = user" option from your share definition becase it belongs in the [global] section.

Share:
8,625
Luca Passariello
Author by

Luca Passariello

Updated on September 18, 2022

Comments

  • Luca Passariello
    Luca Passariello over 1 year


    I am setting up a file server using Samba and Linux. I have the share setup and I can connect to it through Windows File Explorer, but it does not ask for any login details and I cannot modify any files/directories. I have user accounts created for all of the people which will use the server. Below is the share information from my /etc/samba/smb.conf.

        [xshare]
          comment = X's Samba Share
          path = /home/x/share
          read only = no
          browsable = yes
          valid users = x, luca
          security = user
    

    When connecting to my server from Windows Explorer I just get sent to the empty correct directory with no permissions as I did not need to enter credentials. So, my question is, how can I force Samba to require a password on connection which will allow that user to edit files in the directory. The file permissions are correct for the users which will be using the share so all I need is to require a login.

    I've tried adding the admin users to the global share but it did not do anything. Any help is appreciated.

  • Luca Passariello
    Luca Passariello over 5 years
    Thank you so much! The force user attribute worked a treat :)