This page is dedicated to mounting a SMB/CIFS (Samba or Windows) share on the Ubuntu server and making that mount available to all users. We are assuming you already have the Windows/Samba server correctly configured, with correct share and user configuration in place.

First, install smbfs (if not already installed):

sudo apt-get install smbfs

Now, create a file to hold user credentials to the SMB/CIFS share (ex: /root/smbcreds).



Secure the file so only root can see it:

sudo chown root:root /root/smbcreds
sudo chmod 600 /root/smbcreds

Create a directory to hold the mountpoint, under /media. In my experience, mounting something under /media will cause desktop links to appear on all users' desktops.

sudo mkdir -p /media/servername/sharename

Now edit /etc/fstab and add a line to reflect your SMB/CIFS share, newly created mountpoint, and the credentials file we just created (fstab seems to require this instead of passing the "user" / "username" options).


# Windows server share
//server/share        /media/servername/sharename    cifs    credentials=/root/smbcreds,rw    0    0

NOTE: If your SMB/CIFS sharename has spaces in it, use \040 as a space delimiter in fstab - for example, if your sharename is "share name":


Test everything out by either rebooting, or mounting your sharename by mountpoint only, causing mount to look in fstab:

sudo mount /media/servername/sharename
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License