Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jan 2017 13:47:53 -0800
From:      David Christensen <dpchrist@holgerdanske.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD 11.0 and mounting SMB shared folder at boot without password
Message-ID:  <682b235c-1858-aa18-95d9-b7d75eab38f8@holgerdanske.com>
In-Reply-To: <3a018208-2ad4-1b1d-302d-e5ab4f1f2fad@holgerdanske.com>
References:  <3a018208-2ad4-1b1d-302d-e5ab4f1f2fad@holgerdanske.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@freebsd:/root # vim /etc/fstab

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

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

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

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

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

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

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

toor@freebsd:/root # mount | grep smbfs

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

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

toor@freebsd:/root # shutdown -r now

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?682b235c-1858-aa18-95d9-b7d75eab38f8>