Skip to content
Home » Mounting Remote Samba Shares

Mounting Remote Samba Shares

Mounting Remote Samba Shares in Linux


1. Introduction

Mounting a remote Samba share means accessing a shared folder from another system (usually a Samba server) and attaching it to your local file system so it behaves like a local directory.

👉 In simple words:
Remote Samba share = Network folder used like local folder


2. Why Mount Samba Shares?

  • Access shared files across network
  • Centralized storage
  • Collaboration between users
  • Backup and data sharing

3. Requirements

  • Samba server running
  • Shared folder available
  • Username & password
  • Install CIFS utilities

4. Installing Required Package

Ubuntu / Debian

sudo apt install cifs-utils

RHEL / CentOS

sudo yum install cifs-utils

5. Creating Mount Point

sudo mkdir -p /mnt/samba

6. Mounting Samba Share (Temporary Mount)

sudo mount -t cifs //192.168.1.10/shared /mnt/samba -o username=user1

👉 It will ask for password.


7. Mounting with Password (Inline)

sudo mount -t cifs //192.168.1.10/shared /mnt/samba -o username=user1,password=pass123

⚠️ Not secure (visible in command history)


8. Using Credentials File (Recommended)

Step 1: Create Credentials File

sudo vi /root/.smbcred

Add:

username=user1
password=pass123

Step 2: Secure File

sudo chmod 600 /root/.smbcred

Step 3: Mount Using Credentials

sudo mount -t cifs //192.168.1.10/shared /mnt/samba -o credentials=/root/.smbcred

9. Permanent Mount (Auto Mount at Boot)

Edit:

sudo vi /etc/fstab

Add:

//192.168.1.10/shared /mnt/samba cifs credentials=/root/.smbcred 0 0

Apply:

sudo mount -a

10. Unmounting Samba Share

sudo umount /mnt/samba

11. Checking Mounted Shares

df -h

or:

mount | grep cifs

12. Common Mount Options

OptionPurpose
usernameSamba username
passwordPassword
credentialsFile with login details
rwRead-write access
roRead-only
uidSet user ownership
gidSet group ownership

13. Troubleshooting

IssueSolution
Permission deniedCheck credentials
Cannot mountVerify IP/share
Network errorCheck connectivity
Access issuesCheck Samba config

14. Real-World Example

  • Company server: 192.168.1.10
  • Shared folder: shared
  • Users mount it on their systems for daily work

15. Advantages

  • Easy file sharing
  • Centralized access
  • Cross-platform support
  • Flexible mounting options

16. Conclusion

Mounting remote Samba shares allows Linux systems to seamlessly access network resources as local directories. With proper configuration and security practices, it provides a powerful and efficient file-sharing solution in network environments.