How to make samba to ask password on every access?

274

You are using Windows clients, aren't you?

Well, I don't think it's a matter of persistent connections, I think it's rather a matter of cached credentials on clients. And to avoid this, you'll have to tweak your clients. Quoting directly from this page:

Samba does not control client-side password caching.

Caching of domain logon credentials is a client-side activity. There are registry settings on the Windows 2000 Professional and Windows XP Profesional clients that control logon credential caching.

  • Click Start >Run >type gpedit.msc
  • Check Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options
  • Check "Interactive Logon: Number of Previous Logins To Cache" (if value is set to 0 then cached credentials is disabled)

Also check.... - Computer Configuration\Administrative Templates\System\Logon - Check "Always wait for the network at computer startup and logon" (make sure that this is either not configured or disabled)

If you are however using winbind, you may also want to turn off winbind offline logon by adding to your smb.conf:

winbind offline logon = false

EDIT:

I've also found this interesting question. You could try to put a few:

net use \\yourserver\oneofyourshares /delete

into your user's autostart on the clients, so that credential are deleted whenever any user performs a login. Take also a look to this answer. It seems that it's possible to stop Windows caching credentials on a per-share basis in this way:

net use \\a.b.c.d\sharename /user:domain\otheruser /persistent:no

But probably for your task it's sufficient something like:

net use \\yourserver\yourshare /persistent:no

or even:

net use /persistent:no

Find the one that best suits your needs and try to put it into autostart (or in the registry run entries).

Share:
274
MaximeF
Author by

MaximeF

Updated on September 18, 2022

Comments

  • MaximeF
    MaximeF over 1 year

    How do I encrypt a password insert it into the db and after the comparison when he will want to connect?

    I would use Spring security 3.1.

    Link Doc Spring : http://docs.spring.io/spring-security/site/docs/3.1.4.RELEASE/reference/crypto.html Link API SPring security 3.1.4 : http://docs.spring.io/spring-security/site/docs/3.1.4.RELEASE/apidocs/

    • Admin
      Admin over 11 years
      please improve your question showing what hosts are using and what clients are, in order to get answered since there are misunderstanding here. are you using Ubuntu or Windows or what please specify
    • karthick87
      karthick87 over 11 years
      @maythux i have updated my question if you have any queries, pls add it as comments and i will clarify it. Thanks.
    • nicholas.hauschild
      nicholas.hauschild over 10 years
      Please don't encrypt passwords...
  • karthick87
    karthick87 over 11 years
    Is it possible to do this via batch file. If i can create a batch for doing this i can simply apply it to all my windows systems which is connected to domain.
  • Sathiya Narayanan
    Sathiya Narayanan over 11 years
    You should first pinpoint which registry keys are touched by the group policy editor. Then you can simply write your batch file using reg.exe as explained here. For example you can find some hint here or here, etc.