NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Samba: mount shared folder between windows and Linux

Solved!
Go to solution

My computer has windows 7 SP1. My cRIO is 9039(sync) with NI Linux Real-Time x64 4.1.15-rt17-4.0.0f0.

I would like to transfer files between my computer and this cRIO and was suggested to use Samba.

 

I followed this demo: https://forums.ni.com/ni/attachments/ni/7310/123/6/Samba_demo.zip

I have set a shared folder on my PC: C:\data. My cRIO just has username=admin and no password

I have backed up and update /etc/samba/smb.conf as:

 

 

[global]

netbios name = NI-cRIO-9039-Sync-01C4243C
workgroup =  WORKGROUP
security = user
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
smb ports = 445 139
server signing = auto
interfaces = 10.192.64.1/255

[share]

comment = COMMENT
browseable = yes
valid users = admin
admin users = admin
path = /home/admin/shared
writeable = yes
create mask = 0770
force create mode = 0770
locking = yes

Following are the mount command I tried and failed:

mount -t cifs //<myPC_IP>/data /mnt/data -o username=myPCaccount,password=myPassword
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount error(121): Remote I/O error
mount -t cifs //<myPC_IP>/data /mnt/data -o username=myPCaccount,password=myPassword,vers=2.1
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I barely have experience with Linux. Please help me on this.

Thank you.

 

 

0 Kudos
Message 1 of 6
(25,364 Views)

I have used another IP address of the cRIO (from NI MAX).

I have tried to mount again as:

mount -t cifs //<myPC_IP>/data /mnt/data -o username=myPCaccount,password=myPassword

Now the error is:

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

I also tried:

mount -t cifs //<myPC_IP>/data /mnt/data -o username=myPCdomain/myPCaccount,password=myPassword,sec=ntlm

but the error is the same.

 

 

 

0 Kudos
Message 2 of 6
(25,330 Views)
Solution
Accepted by topic author levan8421

You might want to consider using WebDAV to transfer files to your cRIO. It is very simple to setup:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019PlESAU

0 Kudos
Message 3 of 6
(25,327 Views)

I actually have an InsightCM application running on this cRIO. I would like to transfer file in parallel with the application running.

I have tried your suggestion. I can actually transfer files from my computer to cRIO and vice versa.

Now my cRIO is now in Install Mode; my application is not running. I have removed files I transferred into cRIO and restarted the cRIO but it did not work.

0 Kudos
Message 4 of 6
(25,322 Views)

The unfortunate part about using Samba/CIFS is that how to access Windows shares can (and does!) change from release to release (e.g. Windows 98 vs. Windows 10 and everything between) and, worse than that, sometimes dependent on how you've configured the share itself from Windows!

 

One thing that I do see that would be a problem is that you don't set the domain/PC in the manner that you have in the second example. There's a --domain option that can be used. However, if the user is local (seems it is), this isn't necessary.

 

What I would recommend is checking the kernel logs after you attempt to mount the share (dmesg prints the current kernel log) to help determine what's going wrong. Once you've gotten that information, searching online for others who've run into the same issue (with the error message from the kernel log) can usually resolve the problem.

 

Also, one thing that struck me is that you've configured the smb.conf file, which is needed for the server-side of Samba (e.g. if you wanted to grant access from Windows to access files on the 9037), which is separate from accessing the Windows share from Linux (the mount command that you're running). What it is that you're trying to do should dictate which of the systems you need to setup (e.g. do you need access in both directions? Do you want it to be read-only for the client? e.g. from Windows, going to \\$CRIO_IP\$SHARE is read-only? What are your security concerns?) You should have a pretty clear idea of what it is that you need and that will drive the configuration and setup.

0 Kudos
Message 5 of 6
(25,311 Views)

Thank you Brad for your detailed explanation.

I am very inexperienced with Linux and all the steps I followed are from the NI demo.

I have attempted WebDav again. I realized the problem that caused my cRIO stuck in Install mode was the cRIO folder storing files.

There are actually 2 folders that can allow to store files: \home\lvuser and \home\webserv. Before I stored files in lvuser. Now I store files in webserv and the problem disappeared. I suppose lvuser folder is exclusive for the installation files; when i placed some files there, cRIO recognized and tried to process those files.

 

 

0 Kudos
Message 6 of 6
(25,295 Views)