JustToThePoint English Website Version
JustToThePoint en español
Colaborate with us

Mounting TurnKey Linux Samba Shares & Troubleshooting

Humility is the greatest quality that a man can have, and arrogance is undoubtedly the worst, Maulana W. Khan.

Turnkey Linux Fileserver

Turnkey Linux is an open-source project that provides a free library of preconfigured “virtual appliances” built on popular server-oriented open-source software. TurnKey File Server is a relatively user-friendly file server combining Windows-compatible network file shares with a browser-based file manager.

It’s highly recommended that you read our first article. How to Setup TurnKey Linux Fileserver on Proxmox VE walks you through the complete process: downloading the TurnKey Linux Fileserver template, creating and configuring the LXC container in Proxmox VE, setting up the first boot and configuring the TurnKey appliance, accessing Webmin for user and group management, preparing the shared directory, and finally configuring Samba shares to enable file sharing with Windows and other systems.

Mounting the Share on a Client

Temporary Mount with CIFS

# On a Debian/Ubuntu box, install CIFS tools if needed:
sudo apt install cifs-utils
# For NixOS, add cifs-utils to environment.systemPackages
sudo mount.cifs //192.168.1.15/mydata ~/fileserver \
  -o username=YOUR-SAMBA-USER,password=YOUR-SAMBA-PASSWORD,vers=3.0,file_mode=0777,dir_mode=0777
# Example
sudo mount.cifs //192.168.1.15/homedata ~/fileserver \
  -o username=nmaximo7,password=YOUR_PASSWORD,vers=3.0,file_mode=0777,dir_mode=0777

cd fileserver/
nvim test.txt
# You can also see the changes using Webmin UI, Tools, File Manager

# To unmount the CIFS (SMB) share:
cd ..
sudo umount ~/fileserver

where:

  1. //192.168.1.15/homedata is the UNC path to your Samba share.

    A UNC path (Universal Naming Convention path) is a standard format used to specify the location of resources on a network. For Samba shares, the UNC path typically looks like this: \\SERVER_NAME\SHARE_NAME, e.g, \\192.168.1.15\mydata

  2. ~/fileserver is the local mount point where the share will be accessible.
  3. -o username=YOUR-SAMBA-USER,password=YOUR-SAMBA-PASSWORD. These are your Samba user credentials for accessing the share.
  4. vers=3.0 specifies the SMB protocol version to use.
  5. If you can only edit files in ~/fileserver using sudo, adding file_mode and dir_mode can help.

Make sure to replace YOUR-SAMBA-USER and YOUR-SAMBA-PASSWORD with your actual Samba credentials. After mounting, you can access the files in ~/fileserver.

Alternatively, sudo mount.cifs //192.168.1.15/homedata ~/fileserver -o username=YOUR-SAMBA-USER,password=YOUR-SAMBA-PASSWORD,vers=3.0,uid=$(id -u),gid=$(id -g)

Persistent Mount via /etc/fstab

//192.168.1.15/homedata /home/YOUR-SAMBA-USER/fileserver cifs username=YOUR-SAMBA-USER,password=YOUR-SAMBA-PASSWORD,vers=3.0,uid=$(id -u),gid=$(id -g) 0 0
# Alternatively, you can specify the UID and GID directly:
//192.168.1.15/homedata  /home/YOURUSER/fileserver  cifs  username=nmaximo7,password=YOUR_PASSWORD,vers=3.0,uid=1000,gid=1000  0  0

# To test the mount, run:
mount -a
# Then, go to your favorite File Manager (/home/nmaximo7/fileserver)
# Alternatively, Webmin UI, Tools, File Manager
  fileSystems."/home/YOUR-SAMBA-USER/fileserver" = {
    device = "//192.168.1.15/homedata";
    fsType = "cifs";
    options = [
      "username=YOUR-SAMBA-USER"
      "password=YOUR-SAMBA-PASSWORD"
      "vers=3.0"
      "uid=1000"
      "gid=1000"
      "rw"  # Ensure read-write access
    ];
  };

Troubleshooting

sudo mount.cifs //192.168.1.15/homedata /mnt/fileserver \
  -o username=nmaximo7,password=MyPASSWORD,vers=3.0
# mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
  1. Ensure that the Samba user (nmaximo7) exists, has the correct password, and enabledIn the Turnkey Linux Fileserver container, check the Samba users: pdbedit -L (it will list all Samba users).

    # pdbedit, manage the Database of Samba users
    root@filemanager ~# pdbedit -L
    root:0:root
    nmaximo7:1000:Máximo Núnez Alarcón
    
  2. Add the user to the Samba database:smbpasswd -a nmaximo7. Besides, run smbpasswd -e nmaximo7 to make sure the user is enabled in the local smbpasswd file.

    Sometimes, GUI interfaces are not reliable. Make sure to add the user to the Samba database by running: smbpasswd -a nmaximo7.

  3. Verify Share Permissions. In the Webmin UI, go to Servers, Samba Windows File Sharing. Select the share (homedata) and click Security and Access Control. Ensure that: Writable is set to Yes, Valid Users includes nmaximo7, and Valid Groups includes the family group. Samba Windows File Sharing

  4. Filesystem Ownership & Mode. In the Turnkey Linux Fileserver container:

# Ensure that the directory being shared (/mnt/mydata) has the correct ownership and permissions:
chown -R nmaximo7:family /mnt/mydata
chmod -R 775 /mnt/mydata

When you see chown: cannot read directory '/mnt/mydata/lost+found': Permission denied it’s because lost+found is a special directory created by the filesystem to store recovered files after a crash. It’s owned by root:root with mode 0700, and in an unprivileged LXC container the root user inside the container doesn’t have the host-level permissions needed to read or chown it. Ignore the error on lost+found —it’s expected and harmless!

ls -ld /mnt/mydata
drwxrwxr-x 3 nmaximo7 family  2 Jan 15 01:16 /mnt/mydata

# Check smb.conf
nvim /etc/samba/smb.conf
[...]
[homedata]
   path = /mnt/mydata
   read only = no
   writeable = yes
   valid users = nmaximo7
   create mask = 0775
   directory mask = 0775

# Restart the Samba service to apply changes
systemctl restart smbd

apt update && apt install smbclient

# Test access to the share
smbclient //localhost/homedata -U nmaximo7
# If you still get errors, check sudo journalctl -u smbd or dmesg for more clues.
Bitcoin donation

JustToThePoint Copyright © 2011 - 2025 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.