Humility is the greatest quality that a man can have, and arrogance is undoubtedly the worst, Maulana W. Khan.
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.
# On a Debian/Ubuntu box, install CIFS tools if needed:
sudo apt install cifs-utils
# For NixOS, add cifs-utils to environment.systemPackages
Create a local directory where you will mount the Samba share, e.g., sudo mkdir -p ~/fileserver
Mounting the Share (Temporary Mount): You can use the mount.cifs command to mount the share temporarily:
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:
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
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)
//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
];
};
\\192.168.1.15\homedata
. Then, enter your username and password to access the shared folder.
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)
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
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.
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.
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.