Under Linux, Samba (SMB-protokoll, former CIF) is the connection to Windows Networks. NI LinuxRT 2016 supports the old (deprecated) Samba version 3.6, LinuxRT 2018 supports the new (actual) Samba version 4.6 which has support of Microsoft Active Directory (AD), among other things.
More information about Samba: https://wiki.ubuntuusers.de/Samba/ (german)
To mount a Windows Network Share the most common way - and suitable for LinuxRT - is to use the Samba Client CIFS. CIFS is a virtual file system that enables the possibility to mount a network share into the local file system. It is not necessary to install the whole Samba Server for this use case.
To use the CIFS virtual file system the package
cifs-utils is necessary. Install it with:
$ opkg install cifs-utils $
“Temporary Mount” means that you are on the LinuxRT command line (e.g. via SSH) and mount the network share. If you logout the mount will be closed. This approach is good for testing or for just down-/uploading some files from/to a server.
First a directory to mount the share into is needed. Then the common
mount command with special options for CIFS is used. You need to be logged in with root privileges!
$ mkdir /mnt/smb $ mount -t cifs -o username=otto,password=geheim //192.168.1.100/Tausch /mnt/smb $
/mnt/smb is only an example, any other empty directory with sufficient access rights will work.
The share can be unmounted with:
$ umount /mnt/smb $
The network share is automatic mounted when the LinuxRT device boot. This setup is suitable for systems where an application starts and needs access to a network share without further actions.
Again, a directory to mount the share inside is needed (if it doesn't already exist).
$ mkdir /mnt/smb $
Automatic mounting of file systems is handled in the file
/etc/fstab. Add a new line in the following pattern:
//192.168.1.100/Tausch /mnt/smb cifs username=otto,password=geheim 0 0
In tests on a cRIO-9030 with LinuxRT 4.0.0f0 this alone doesn't work. When the cRIO is booting the mounting of file systems is executed before the network is up and running, hence mounting the network share fails.
A workaround is to disable the automatic mounting by adding the option
noauto and add a call to the
mount command at the end of the boot process. To do this create a new file with the following content in
/etc/rc5.d/. The filename should start with
S99 to be executed as late as possible in the boot order (e.g.
#!/bin/sh mount /mnt/MOUNT_DIR
The new file must have execution rights.
$ chmod +x /etc/rc5.d/S99_mount_smb $
lvuser is the standard account for running all LabVIEW programs. Because this user has no root privileges it can not mount a network share without further configuration. First, a line in the file
/etc/fstab like above is needed and this line must have the option
users to allow any user to mount and unmount a file system.
Example entry in fstab:
//192.168.1.100/Tausch /mnt/smb cifs noauto,users,username=otto,password=geheim 0 0
Second, the CIFS mount program must have the SUID-Bit set. To do this execute the following command (as admin):
$ chmod +s /sbin/mount.cifs $
Now it's possible to mount and unmount the network share as user lvuser, e.g. from LabVIEW with
In default the mounted files and directories have the user- and group-id from the server. To map the IDs to a local user (e.g. lvuser) you can add the mount options (in the mount-command or in fstab)
gid=GROUP. If the user lvuser and the group ni have the ID 500, a complete line in the file
fstab could be:
//192.168.1.100/Tausch /mnt/smb cifs noauto,users,uid=500,gid=500,username=otto,password=geheim 0 0