Sharing files from OpenELEC

From OpenELEC
Jump to: navigation, search
20px   OpenELEC Configuration Sharing files from OpenELEC

Network-drive-connected-icon.png

This tutorial describes how to share files stored on your OpenELEC computer with other machines on the network.

Even if you're trying to share files from a USB drive, we can manage that since local drive mounting occurs before network services start.

First of all, you'll need access to your configuration files. There are two ways to do this and I'm going to cover the easier one. If you have experience with Linux, you can use ssh/putty to open a terminal to your OpenELEC machine (there are guides on how to do this elsewhere on the site); the configuration files are held in /storage/.config and you can use vi or nano to edit them.

However, for most users the easiest way is to browse to the Configfiles share that already exists on the OpenELEC machine.

From a Windows PC, open an explorer window and browse to the IP address or the network name of the OpenELEC machine.

Browser address bar IPaddress.png or Browser address bar networkname.png

  • If you don't know what the IP address is, go to the menu of the OpenELEC machine : System > System Info. This will open a page that shows the IP address, so type this into the address bar of the explorer window.
  • If you don't know what is the network name is, go to the menu of the OpenELEC machine : System > OpenElec > System. It is the name in the field System Name


Samba.share.png

Once the window appears, open the Configfiles share. This will show you all the configuration files for your OpenELEC machine.

To share files with other computers, OpenELEC uses a process called Samba. It's a process that runs on the computer and uses the CIFS protocol to share files across the network.

The file in the Configfiles share called samba.conf.sample is the one we're interested in. It controlls the shares presented by the Samba server daemon on the OpenELEC machine. Open the file with Wordpad (but *not* Notepad). The first section of the file is a disclaimer, followed by the Global section which is to do with the configuration of the Samba daemon running on the OpenELEC machine, we'll leave this alone as there's no need to change it.

# samba.conf
# This configuration file allows you to customize the samba shares
# available from your machine
[global]
server string = Media Centre(%i)
workgroup = WORKGROUP
netbios name = openelec
security = share
guest account = root
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
wins support = yes
syslog only = yes
name resolve order = lmhosts wins bcast host
# Using the following configurations as a template allows you to add
# writable shares of disks and paths under /storage

The next sections each define a share from the OpenELEC machine. There are a number of default shares, and they all follow the same format:

[Videos]
path = /storage/videos
available = yes
browsable = yes
public = yes
writable = yes
root preexec = mkdir -p /storage/videos
To quickly break this down:
  • [Videos] (this is the share name; it's how the share will appear on the network)
  • path = /storage/videos (this is the location that will be shared)
  • available = yes (makes the share accessible)
  • browsable = yes (can you browse to the share, or do you need to type it in manually)
  • public = yes (allows unauthorised users to access the share)
  • writable = yes (allows write access to the share)
  • root preexec = mkdir -p /storage/videos (if the folder doesn't exist, create it)

To create a new share, we can use the same format. For example, if we wanted to share /media (where USB drives get mounted to), we could use:

[USB Drives]
path = /media
available = yes
browsable = yes
public = yes
writable = yes

I've removed the last line that creates the folder as we don't need it in most cases (where the folder already exists).

Now, save the file with your new share and close your editor. Rename the file from samba.conf.sample to samba.conf (remove the .sample) and close the explorer window. Restart your OpenELEC box and use explorer to browse to the IP address again - you should see your new share! You can open and edit the file at any time - you can remove shares too, but remember that if you remove the Configfiles share it will be much harder to reconfigure the shares.