Permanently mount a samba share using fstab

Guest account: no password needed
To permanently mount a samba share using fstab:

First, let’s create the mount directory. You will need a separate directory for each mount.

sudo mkdir /media/yourlocalsharenamename

Next backup and then edit your /etc/fstab file (with root privileges):

sudo cp /etc/fstab /etc/fstab.bak

gksudo gedit /etc/fstab

Scroll to the bottom of the file and add this line:

//yourservername/yoursharename /media/yourlocalsharename cifs guest,uid=1000 0 0

Where

  • guest indicates you don’t need a password to access the share,
  • uid=1000 makes the Linux user specified by the id the owner of the mounted share, allowing them to rename files,

After you add the entry to /etc/fstab save and exit gedit. Then type:

sudo mount -a

This will (re)mount all entries listed in /etc/fstab. Finally check to see that your share was mounted. You also might want to look at /var/log/demesg to make sure there were no errors when you mounted your file.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: