Mounting Samba SMB share on Ubuntu

Procedure for mounting Samba SMB share on Ubuntu. This will natively mount the samba share onto your Ubuntu system and reconnect upon startup.

  1. Install package cifs-utils (even if you already have Samba and related packages installed):

 sudo apt-get install cifs-utils

2. Create folder to mount the share into:

 sudo mkdir /media/Share

3. Create file with user credentials in your home directory

touch ~/.smbcredentials

3.1. Edit the file to add credentials

Nano ~/.smbcredentials

(optional domain=domain_or_workgroupname)

3.2 Set Permissions to secure your ~/.smbcredentials file:

chmod 0600 ~/.smbcredentials

4. Edit /etc/fstab and add your entry for auto mount:

sudo nano /etc/fstab

5. Add the following line (edit where necessary, server, username, etc.)


//share /media/Share cifs credentials=/home//.smbcredentials 0 0

Specify UID and GID:

//share /media/Share cifs credentials=/home//.smbcredentials,uid=,gid= 0 0

Specifying Character Set and Security:

//share /media/Share cifs credentials=/home//.smbcredentials,users,rw,iocharset=utf8,sec=ntlm 0 0

6. Finally, test the mount with:

sudo mount -a

About the author: Amro Sahli

You must be logged in to post a comment.