From owner-freebsd-questions@freebsd.org Fri Jan 20 21:47:55 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86705CBAC93 for ; Fri, 20 Jan 2017 21:47:55 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [IPv6:2001:470:0:19b::b869:801b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.he.net", Issuer "GeoTrust SSL CA - G4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7714A120F for ; Fri, 20 Jan 2017 21:47:55 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from ::ffff:99.100.19.101 ([99.100.19.101]) by holgerdanske.com with ESMTPSA (AES128-SHA:SSLv3:Kx=RSA:Au=RSA:Enc=AES(128):Mac=SHA1) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Fri, 20 Jan 2017 13:47:53 -0800 Subject: Re: FreeBSD 11.0 and mounting SMB shared folder at boot without password To: freebsd-questions@freebsd.org References: <3a018208-2ad4-1b1d-302d-e5ab4f1f2fad@holgerdanske.com> From: David Christensen Message-ID: <682b235c-1858-aa18-95d9-b7d75eab38f8@holgerdanske.com> Date: Fri, 20 Jan 2017 13:47:53 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <3a018208-2ad4-1b1d-302d-e5ab4f1f2fad@holgerdanske.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2017 21:47:55 -0000 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 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)