FreeBSD: Automounting Samba Shares

From The Wiki Guide

Jump to: navigation, search

Contents

Introduction

This guide will allow you to automatically mount your windows shares on your FreeBSD Machine on startup

Editing fstab

  1. "nano /etc/fstab"
    • In a new line type "//User@Servername/Share /UnixMountPoint smbfs rw,noauto 0 0"
    • Add one line for each of your shares.....

Editing nsmb.conf

  1. "nano /etc/nsmb.conf"
    • All the way towards the end is a nice place to insert the following:
      • [SERVERNAME:USER]
      • password=YourWindowsSharePassword
    • Then "chmod 600 /etc/nsmb.conf"(Wanna protect your cleartext password)

Creating Automount Script

  1. Lets create a script for mounting the share on boot
    1. "nano /usr/local/etc/rc.d/yourscript.sh"
    2. Inside the script simply type "mount /UnixMountPoint"
    3. Save the script, "chmod 700 yourscript.sh"

Final Considerations

  • You must make a script for each mount, i.e. only one mount or unmount per script!
  • Also as you noted above /usr/local/etc/rc.d/ (is the place to put all your "nifty" startup scripts)
  • Just boot up and you should be good youll see in bold white "netsmb_dev: loaded"
Personal tools