Samba on Yun

Hi all,

Just wanted to share this as I couldn't find it on the forum.
For all those who want to access the SD card on the Yun from a Windows PC.
It's fairly easy to do.
Goto "advanced configuration panel" after logging onto the Yun.
Goto "System" "Software" and hit "Update lists".
In the" Filter: " field type samba and hit "Find package" button.
Goto "Available packages (samba) and click "Install"
Then goto "System" "Startup" and make sure samba is "Enabled"

When this is done you can reboot your yun and check by going back to "System" "Startup" if samba is "Enabled".
Samba is running now.

Now it is time to add your share and make sure the shared folder is writeable.
Therefore you need to edit a config file under Linux (Linino) so you need to make an SSH connection by using Putty tool (use Google to find and install the tool).
You also need to install nano (I find this an easy tool to edit files under Linux). To install this you can do the same as installing Samba (above) by replacing the search for samba by nano. after nano is installed no need to reboot.

Launch Putty and login with root and your Yun password.
Now edit the following file (will create a share for the 'arduino' folder on your SD card).
Type nano /etc/config/samba
If all OK you will see the below. You need to add the part in Bold.

config samba
option 'name' 'OpenWrt'
option 'workgroup' 'WORKGROUP'
option 'description' 'OpenWrt'
option 'homes' '1'

config 'sambashare'
** option 'name' 'arduino'**
** option 'path' 'mnt/sd/arduino'**
** option 'guest_ok' 'yes'**

Ones added press 'Ctrl' 'X' next 'Y' and 'Enter'. Now your configuration file is updated.

We are not done yet as we need to make a reference to the mounting point and add write rights to the folder on the SD card.
As the file system on the SD card is FAT we can't just change the rights using Linux command 'chmod' so we will have to fool Linux.

Go back to your browser where you have the "advanced configuration panel" still open.
Now goto "System" "Mount Points". In the middle of the screen you will see Mount Points. There you need to hit the "Add" button.
In the new screen you now have a tab called "General settings" and one called "Advanced Settings".

In the "General settings" you need to enter the following:
Device: /dev/sda1 (xxxx MB) (is a drop down)
Mount point: /mnt/sda1
Filesystem: vfat (is also a drop down)

Now go to the "Advanced Setting" tab and add:
Mount options: umask=000
This gives full read and write rights so no security!
leave the 2 other options 'UUID' and 'Label' blank.

Reboot your Yun and try to access from your Windows platform. Make sure your firewall (Windows or Anti-Virus tool allows NETBIOS).

I'm sure there is a more secure way to set this up but for what I need it it's OK as is.
I can now easily edit my PHP files on the SD card using notePad++.

Good sharing

I have a Python script that runs on my PC accessing data from the Yun's sd card. Using the above procedure, the Yun mounted as "OpenWrt" and the script runs. That's the good news. :slight_smile:
However, after awhile, it disappeared! :frowning: Not sure exactly when or how, but perhaps after PC sleep or something like that.
So, how do I get it back? Other devices such as my NAS and MacBook Pro laptop are showing up OK. And from my MacBook Pro, I can successfully mount with smb://arduinoyun.local. I have rebooted the Yun, rebooted the router, restarted my PC, all to no avail.
Any suggestions?
Thanks in advance.

Hi,

Very strange. It is always availble on all my PCs. You might have a firewall rule blocking NETBIOS name. Try using the Yun's IP address instead of the NETBIOS name when ac cessing it. I have given my Yun a fix IP address. To avoid name lookup problems you can always put the name and IP address in your hosts file.

GKinAZ:
I have a Python script that runs on my PC accessing data from the Yun's sd card. Using the above procedure, the Yun mounted as "OpenWrt" and the script runs. That's the good news. :slight_smile:
However, after awhile, it disappeared! :frowning: Not sure exactly when or how, but perhaps after PC sleep or something like that.
So, how do I get it back? Other devices such as my NAS and MacBook Pro laptop are showing up OK. And from my MacBook Pro, I can successfully mount with smb://arduinoyun.local. I have rebooted the Yun, rebooted the router, restarted my PC, all to no avail.
Any suggestions?
Thanks in advance.

If working at Macintosh as well as Linux but fail at Windows, it could be combination of ISP DNS server hijacking .local domain and Microsoft implementation of zeroconf.

http://forum.arduino.cc/index.php?topic=188101.msg1617043#msg1617043

Has anyone been able to connect with Samba to a network share and send a file to it?

dacoolfrenchie:
Has anyone been able to connect with Samba to a network share and send a file to it?

http://forum.arduino.cc/index.php?topic=209335.msg1541048#msg1541048

http://forum.arduino.cc/index.php?topic=210753.msg1546888#msg1546888

Works great!! Thank you - should be added to the Reference Page

One correction: Add the procedure to check the box to [] Enable this mount.

Also I made the WORKGROUP the same as the workgroup name I use on NetBIOS.

reading from the SD Card within Windows 7 works fine, but I dont seem to have write permissions.

have setup as per instructions I think

any clues please ?

thanks .. Mike

fixed it by formatting the SD card to ext3 and write permissions to the www folder

Got it to work as read only from both Mac and Win Server 2008 after following the instructions (with one exception - I had to select /dev/sda on the Arduino Mount Points/Device instead of /dev/sda1) however cannot write to it. This is in spite of putting umask=000 in Mount options. Did not try to format to ext3 as mikeruss suggested, I need the SD card to be in FAT32 format

Any suggestions?

To make writable:

chmod a+w /mnt/sda1
/etc/init.d/samba restart

/mnt/sda1 is mount point of /dev/sda1 change it to match yours.

To visualize follow OP direction:

http://wiki.openwrt.org/doc/recipes/usb-storage-samba-webinterface

It works! Thank you for sharing.

I tried all of the above and still didn't get write access to the SD from Windows 10. After much surfing, I added the following line to my samba configuration to fix it.

option 'read_only' 'no'

I'm not a Samba expert, but it looks as though this line shouldn't have been necessary as the same option was selected under luci. Still as result is a result. Thanks luceec for taking the time to share your knowledge. I wouldn't have got anywhere with this matter without it.