FreeBSD 11.0 and mounting SMB shared folder at boot without password

David Christensen dpchrist at holgerdanske.com
Fri Jan 20 21:47:55 UTC 2017


On 01/19/17 20:35, David Christensen wrote:
> I am attempting to mount a Microsoft Windows shared folder
> ... into my home directory ... at boot, without having to enter my
> password.

I figured it out:

1.  Configuration file for mount_smbfs -N option must be /etc/nsmb.conf:

     a.  /usr/home/dpchrist/.nsmbrc does not work.

     b.  /usr/local/etc/nsmb.conf does not work.

     c.  /root/.nsmbrc works when mount_smbfs is invoked from the 
command line, but fails at boot.

2.  The (SMB) user name and host name in /etc/nsmb.conf must be upper 
case (my workgroup name was already upper case).

3.  For better security, I adjusted permissions of /etc/nsmb.conf and 
encrypted my (SMB) password using smbutil(1).


A console session follows.


David



toor at freebsd:/root # vim /etc/fstab

     //dpchrist at cd2533/data /usr/home/dpchrist/.data smbfs rw,-N 0 0

toor at freebsd:/root # touch /etc/nsmb.conf

toor at freebsd:/root # chmod 0600 /etc/nsmb.conf

toor at freebsd:/root # smbutil crypt >> /etc/nsmb.conf
Password:

toor at freebsd:/root # vim /etc/nsmb.conf

     [default]
     workgroup=WORKGROUP
     [CD2533:DPCHRIST]
     password=$$1<redacted>

toor at freebsd:/root # ls -l /etc/nsmb.conf
-rw-------  1 root  wheel  83 Jan 20 13:33 /etc/nsmb.conf

toor at freebsd:/root # mount | grep smbfs

toor at freebsd:/root # mount /usr/home/dpchrist/.data

toor at freebsd:/root # mount | grep smbfs
//DPCHRIST at CD2533/DATA on /usr/home/dpchrist/.data (smbfs)

toor at freebsd:/root # shutdown -r now

toor at freebsd:/root # mount | grep smbfs
//DPCHRIST at CD2533/DATA on /usr/home/dpchrist/.data (smbfs)



More information about the freebsd-questions mailing list