Best place for samba credentials for fstab in 2025?

I think I have seen somewhere in a post here that if you have system-wide credentials for a samba filesystem mounted via /etc/fstab, there’s now somewhere in /etc a designated ... .d directory (you might have to create it) where you can put stuff like this, and samba automatically loads from there without the need for giving a path, just the filename is enough.

Unfortunately, I cannot find this post anymore. Could someone confirm this and point me to some more info? The docs for samba are a mess, their website has a solid 2000s feel and everything you find in the net is stale information for ages-old versions.

So, I appeal to the shared wisdom of the EndeavourOS users: Can you help me here?

you mean this: https://wiki.archlinux.org/title/Samba#Storing_share_passwords ?

No. I read this (spent a good part of two hours for some research), and they still reference the full, absolute path:

For the mount command replace username=myuser,password=mypass with credentials=/etc/samba/credentials/share.

I am not hung up on the omission of the path per se, but the existence of a ... .d directory for samba stuff, similar to /etc/pacman.d or others, intrigues me. This is what I am after.

Don’t know if you are looking for this exactly, but I think it sure comes close.

I’m going to add a bit of a tangent here, because I went through this a while back. Here’s my approach:

  • Set up a user server-side with the same name and UID as your client-side username.
  • Define the permissions server side, and leave your fstab to handle connectivity alone.

I did it this way to prevent any credentials being leaked by a potentially insecure storage method or attack vector.