Solved automount smb/cifs storage

I have several smb shares on linux boxes that I need access to and for the life of me I cannot make mount_smbfs work with the automounter. I can manually run the mount command as root and specify the password, but any attempt to add the mount line to /etc/auto_misc (a map file that puts stuff under /misc) or to automatically specify the password thru the .nsmbrc and /etc/nsmb.conf config files and I either break my mount map in the first case, or get an authorization error in the second.

I know automount works because in the preceding map line I mount an nfs4 partition from a server flawlessly. When I add the
sharename -fstype=smbfs,N //USER@FILES/sharename
map on the next line though, the whole map file becomes invalid.

I am aware of the wins vs dns name issues. While no wins server is running, I have tried specifying server DNS and IP using -I 10.1.11.118 component in the mount. Again, that works when I specify the password manually but I cannot get any connection thru the config files that should be read to provide wins translation and user/password information for my shares. I'm always attempting the mounts as root or under sudo so I wouldn't expect $HOME/.nsmbrc to be in play.

trying in /etc/nsmb.conf

[FILES]
addr=10.1.11.118

[FILES:USER]
password=mypassword

There are about a dozen ways to specify user credentials under SMB, so why does this have to be so hard? Will the automounter map or the mount command recognize user%password as part of the share URI?

I need these mounts thru the automounter. under linux they work flawlessly using autofs maps, and credential files or user=,password= in the mount lines.
 
Does no one use this kind of configuration or have I just covered all the easy possibilities?

mount_smbfs under automount, supplying user credentials in /etc/nsmb.conf file doesn't seem to work.
 
I think mount_smbfs only supports smb1, which is not very popular these days.
Understood...but I mention before that it works when manually started as root and supplying the password when asked. The only part that doesn't work is the "files based" user credentials. Also, I have a pretty much locked down R&D lab at my house with ample firewalling so I'm not too concerned about anyone less sophisticated than "state actors" accessing my net. SMB1 is adequate for my internal shares. I also have some older media streaming boxes that don't support anything newer.
 
I'm using direct map but it's the same otherwise:
Code:
# grep -vE '^$|^#' /etc/auto_master
/-    auto.direct
#
Code:
# grep -vE '^$|^#' /etc/auto.direct
/import/smalldepot    -fstype=smbfs ://devadm@win22/smalldepot
#
Code:
# cat /etc/nsmb.conf
[WIN22:DEVADM]
password=Secur3!
As mentioned it's only SMB1 but it may be enough for home use.

You mentioned you can mount it manually so there's no problem. Side note then, on Windows side to check/enable/disable SMB1:
Code:
Get-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol
 
_martin is the colon required? It was not required for my nfs4 mount map.
storage -fstype=nfs4,soft files:/6TB/storage
/import/smalldepot -fstype=smbfs ://devadm@win22/smalldepot


Also, keep in mind that I'm using an indirect map file to put stuff under /etc/auto_misc as /misc so no preceeding / in the map entry name

What I've attempted is pretty much what you supplied, except that I did not use a colon before the sharename URI. Having hardware problems with SATA at the moment, but not BSD specific...will followup when I can hack together the workstation in a way suitable to test.
 
Actually, I see that at least for autofs(5) is does need the colon. That may have been my problem. Will investigate. Thanks!
 
nfs and smbfs are not the same. Yes, samba entries do require the colon.
It doesn't matter if you use direct or indirect maps. It's just that I'm using direct maps in the example. Maybe I should've omitted stating that.
 
the maps are no longer syntactically incorrect but the mount fails with the following error:

Code:
May 30 19:56:58 greybox automountd[1309]: "mount -t smbfs -o automounted //KENT@FILES/tclps /misc/tclps/", pid 1310, terminated with exit status 1
May 30 19:56:58 greybox kernel: WARNING: autofs_trigger_one: request for /misc/tclps/ completed with error 5, pid 1305 (ls)
May 30 19:56:58 greybox automountd[1309]: mount failed

Not seeing any indication in the smbd logs that any attempted samba connection is made. Wireshark confirms this. No attempted traffic to the smbd/linux server.
 
Back
Top