Jump to content

CIFS and SMBFS

From Teltonika Networks Wiki

The information on this page is updated in accordance with the 00.07.23 firmware version.

Introduction

This guide explains how to mount a remote shared folder on a Teltonika Networks router using the CIFS (Common Internet File System) protocol and SMBFS (Server Message Block File System) - network file sharing protocols that allow devices to access files and directories over a local network, enabling file exchange between the router and other devices such as Windows PCs or Linux machines. Two configuration examples are covered:

  • Mounting a shared folder hosted on a Windows PC - the Windows PC hosts the shared folder, and the router mounts it.
  • Mounting a shared folder hosted on a Linux device - a Linux machine running Samba hosts the shared folder, and the router mounts it.

Note: Although the Linux mount command uses -t cifs, it is used to mount modern SMB shares (SMB2/SMB3), not only the legacy CIFS (SMB1) protocol.

Setup and prerequisites

  • A Teltonika Networks router with the CIFS/SMBFS filesystem support package installed. The package can be installed through the router WebUI by navigating to System → Package Manager and installing the CIFS/SMBFS filesystem support package.
  • A Windows or Linux computer connected to the same LAN as the router.
  • SSH access to the router.

Windows PC as file server

This section explains how to configure the router as a CIFS client and mount a shared folder hosted on a Windows 11 machine.

Topology

Windows 11 machine - acts as the file server. The RUTM16 connects to the Windows 11 machine over the local network and mounts a shared folder.

Step 1: Create and share a folder on Windows

Create the folder you want to share. In this example, C:\testCIFS is used.

Open PowerShell as Administrator and run:

New-SmbShare -Name "testCIFS" -Path "C:\testCIFS" -FullAccess "Authenticated Users"

Verify the share is active:

net share

You should see testCIFS listed with the path C:\testCIFS.

Step 2: Create a local Windows user for CIFS authentication

To create a local user account, open the Windows Start menu and search for "Local Users and Groups", or press Win + R, type lusrmgr.msc, and press Enter. Or use PowerShell:

$password = ConvertTo-SecureString "CIFSuser11!" -AsPlainText -Force
New-LocalUser -Name "cifuser" -Password $password -FullName "CIFS User" -PasswordNeverExpires

Note: If you created the user via the GUI and were prompted to change the password on first login, disable that requirement:

net user cifuser /logonpasswordchg:no
Set-LocalUser -Name "cifuser" -PasswordNeverExpires $true

Now grant the user access to the share and the folder. Replace HOSTNAME with your own machine hostname (find it with the hostname command):

Grant-SmbShareAccess -Name "testCIFS" -AccountName "HOSTNAME\cifuser" -AccessRight Full -Force
icacls "C:\testCIFS" /grant "HOSTNAME\cifuser:(OI)(CI)F"

Step 3: Mount the Windows share on the router

Access the router's CLI and create a mount point directory:

mkdir -p /mnt/testcifs

Mount the Windows share using CIFS:

mount -t cifs //192.168.1.7/testCIFS /mnt/testcifs -o username=cifuser,password=CIFSuser11!
Option Description
mount Mounts a filesystem and makes it accessible at a local directory
-t cifs Specifies that the filesystem type is CIFS/SMB
//192.168.1.7/testCIFS Windows PC IP address and share name
/mnt/testcifs Local mount point on the router where the share will be accessible
username=cifuser The local Windows user used for CIFS authentication
password=CIFSuser11! Password for that account

Step 4: Verify the mount

Confirm the share is mounted:

mount | grep cifs
df | grep cifs

List the contents:

ls /mnt/testcifs

To unmount:

umount /mnt/testcifs


Linux device as file server

This section explains how to configure the router as a CIFS client and mount a shared folder hosted on a Linux machine running Samba.

Topology

Linux machine - acts as the file server. The RUTM16 connects to the Linux machine over the local network and mounts a Samba shared folder.


Step 1: Create the shared directory on Linux

Create the directory that will be shared. In this example /home/user/shared is used:

mkdir -p /home/user/shared

Set permissions on the directory. The example below grants full access to all users; restrict this appropriately in production environments:

chmod 777 /home/user/shared

Step 2: Install Samba on Linux

sudo apt update && sudo apt install -y samba

Step 3: Create a Samba user

Samba maintains its own password database separate from Linux system accounts. Add your current Linux user to it:

sudo smbpasswd -a $USER

You will be prompted to set a Samba password. This password is used when mounting the share from the router.

Note: The Samba username will match your current Linux username. Run whoami if you are unsure what it is.

Step 4: Configure the Samba share

Edit the Samba configuration file:

sudo nano /etc/samba/smb.conf

Add the following block at the very end of the file:

[shared]
   path = /home/user/shared
   browseable = yes
   read only = no
   guest ok = no
   valid users = user
   writeable = yes
Option Description
[shared] Creates a Samba share named "shared" — this is the name used in the mount path
path Local directory on the Linux machine to be shared
browseable = yes Allows the share to appear in network share listings
read only = no Permits file creation, modification, and deletion
guest ok = no Requires authentication; no anonymous access allowed
valid users Only the specified user is permitted to access the share
writeable = yes Makes the share writable (equivalent to read only = no)

Verify the configuration has no syntax errors:

testparm

Apply the configuration by restarting the Samba service:

sudo systemctl restart smbd

If the Linux machine has ufw firewall enabled, allow Samba traffic:

sudo ufw allow samba

Step 5: Create a mount point on the router and mount the share

Access the router's CLI and create a mount point directory:

mkdir -p /mnt/ubuntu_share

Mount the Samba share using CIFS. Replace 192.168.1.120 with the actual IP address of your Linux machine, and user with your Samba username and password:

mount -t cifs //192.168.1.120/shared /mnt/ubuntu_share -o username=user,password=user
Option Description
mount Mounts a filesystem and makes it accessible at a local directory
-t cifs Specifies that the filesystem type is CIFS/SMB
//192.168.1.120/shared Linux machine IP address and Samba share name
/mnt/ubuntu_share Local mount point on the router where the share will be accessible
username= Samba username (matches the Linux system username)
password= Samba password set with smbpasswd

Step 6: Verify the mount

Confirm the share is mounted on the router:

mount | grep cifs
df | grep cifs

To unmount:

umount /mnt/ubuntu_share

External links

Samba smb.conf reference

Teltonika Networks Command Line Interfaces