LinuxMint or Ubuntu: Automount Server Share

(Updated to reflect changes in Ubuntu 12.04 LTS – 5/15/2012)

While I’m still not 100% sure how I got my file server to share all the files across the network (whatever I did, it worked; when the server dies, I’ll figure it out and post it here).  Regardless, I recently reformatted my desktop and had to set up the file server share to automount on my desktop for easy access to the files (I store all my music, videos, and lots of other files on the file server).  Here are the steps I took to set up my automounting file share on my Linux desktop (courtesy of the ubuntu wiki and this website as well).

1) First you need to install two packages: “samba” and “smbfs.” You can install these from the terminal or using synaptic.  Here’s how you would do it from the terminal:

sudo apt-get install samba smbfs

2) Once those are installed, you need to create a mount point for your share.  The easiest way to do this is from the terminal as it requires root privileges.  The share, which, in my case, is called “fileshare” is mounted in my user directory, so you use the following:

sudo mkdir /home/(your username)/fileserver

3) Next you need to edit the fstab file.  This is a file that tells the operating system which drives should be mounted on startup.  To edit it, enter the following at the terminal:

sudo gedit /etc/fstab

4) The text editor will pop up with your fstab file open for editing.  You need to add a line to the fstab file that tells the operating system what to mount on startup, where to mount it, and what permissions to use.  Here is the line I used

//192.168.3.101/fileserver-share  /home/ryan/fileserver  smbfs  username=XXXXX,password=XXXXXXX 0 0

What this tells the operating system is that I want to mount a network share “//192.168.3.101/server-share/” into the folder “/home/ryan/fileserver”.  I do this with the software package “smbfs.”  You’ll need your username and password for the target machine.  Save the fstab file and close it.

5) The last step is to go ahead and mount the share.  This is also done from the terminal using the following command:

sudo mount -a

This tells the operating system to remount everything in your fstab file.  Your file share should now show up as a drive on your desktop and you should be able to read and write to it directly as if it were a drive on your computer.