Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Dec 2012 17:57:59 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Hanafi Syahroini <hanafi@zigma-jp.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Mounting a samba share on boot?
Message-ID:  <20121211175759.310ec79f.freebsd@edvax.de>
In-Reply-To: <CAON8%2BsbL_1AOF7vaqDg1AeX0Gi2ZL9fCT80Zf1Rxrv8ieDDM=Q@mail.gmail.com>
References:  <CAON8%2BsbL_1AOF7vaqDg1AeX0Gi2ZL9fCT80Zf1Rxrv8ieDDM=Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 11 Dec 2012 23:25:56 +0700, Hanafi Syahroini wrote:
> [nothing]

First of all, it's not uncommon to place the question into
the message body (which you did not), and using a descriptive
subject (which you did). :-)

So I assume your question is _how_ to mount a SMB share at
boot.

This can be easily done by adding the required line to the
/etc/fstab file. Because network connection is required to
perform the mount, you could use the "late" option in
addition to other options you might need. See "man mount"
for detais, as well as /etc/rc.d/mountlate.

The line would be like this:

	//USERNAME@SERVERNAME/share  /smb/share  smbfs  rw,late  0  0

In this example, SERVERNAME is the server to access, and "share"
the name of the share; /smb/share will be the directory it will
be mounted at.

Access to multiple "drive letters" would look like this:

	//Administrator@WINPC/a$  /smb/a  smbfs  rw,late  0  0
	//Administrator@WINPC/c$  /smb/c  smbfs  rw,late  0  0
	//Administrator@WINPC/d$  /smb/d  smbfs  rw,late  0  0
	//Administrator@WINPC/e$  /smb/e  smbfs  rw,late  0  0
	//Administrator@WINPC/f$  /smb/f  smbfs  rw,late  0  0

Here "WINPC" is the name of the server. Using "Administrator"
in this case is not safe, but no problem in settings where
people don't care for security anyway. :-)

Also see "man smbfs" and "man fstab" for details.

It might be required to put additional information in
/etc/nsmb.conf, for example:

	[default]
	workgroup=YOUR_WORKGROUP_NAME

	[SERVERNAME]
	addr=192.168.2.2

	[SERVERNAME:USERNAME]
	password=TOPSECRET

Substitute SERVERNAME, USERNAME and TOPSECRET for the
organisational information and access credentials that apply.
See "man nsmb.conf" for details.

Further instructions can easily be found in the online docs:

http://www.freebsd.org/doc/faq/book.html#mount-smb-share

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-samba.html



Note that if you still encounter network problems, it's better
to write a short rc.d style script that performs the mount_smb
commands, and use the proper keywords to have it run when the
network connection is up and running. See "man rc.d" for
details.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121211175759.310ec79f.freebsd>