File sharing with a NAS, media server, windows share or other device

#1

Whether you already have a media sharing system on your network or are setting one up for the first time the options can be bewildering. To stream high-quality video you will want the fastest possible connections. Unfortunately, the easiest systems to set up are also the least efficient so some effort is needed to get the best performance. Here are some recommendations.

This assumes you have already set up the wired or wireless LAN connections between the server where you store your media and the client(s) where you want to play it. See here: https://osmc.tv/wiki/general/setting-up-your-network-connection/

Any machine can act as a server, including one running OSMC (see OSMC as a server below). You will get the best performance, especially if there are lots of clients, from a purpose-made NAS.

Choosing a filesharing protocol

If you have a NAS that offers the NFS filesharing protocol, choose that for best performance with OSMC devices. NFS is the built-in network filesharing system in Linux. Windows (but not ‘Home’ versions) also has an NFS client so you can still access those NAS files from Windows.

If you keep your media on a Windows machine then it makes sense to use the SMB protocol, otherwise known as CIFS, especially if you have other Windows machines on the network. SMB is built in to every version of Windows. Linux machines connect to SMB shares using a package called Samba. They can’t join a ‘HomeGroup’ but according to this: http://kodi.wiki/view/SMB/Windows they can access shares created using a homegroup. The Samba client is included in OSMC, the Samba server is optional.

If your NAS or other device where you store media supports only SMB version 1 you may have to adjust the SMB version in Kodi (see below). See also https://blogs.technet.microsoft.com/filecab/2017/06/01/smb1-product-clearinghouse/

If you really don’t want to use SMB on Windows, there are NFS servers available. See here: https://forum.kodi.tv/showthread.php?tid=329452.

We do not generally recommend the use of UPnP for security and performance reasons, but if you already have a UPnP/DLNA server it should be the easiest of all to set up. Some media servers may offer only UPnP for sharing. OSMC has a built-in UPnP server.

Note that any filesystem format can be used with any protocol, for example you can share NTFS files using NFS or Linux (ext4) files using SMB. File ownership and permissions won’t necessarily translate but that won’t matter for media files. It stands to reason though to expect a Windows filesystem to be served best with a Windows filesharing protocol and a Linux filesystem to be served best with a Linux protocol. You can also share the same files with two different protocols at the same time.

OSMC does not support AFP. Apple Mac users can use SMB.

OSMC as a client – using Kodi

If you have a media server already you can connect to it using SMB, NFS or UPnP from the Kodi GUI but you may not get the best performance that way. When you add a source, you will be able to browse to any available NFS shares or UPnP devices. To add a network share pick Music (say) then Files then Add music and enter the network location as follows or click left to browse to the location.

If using NFS, nfs://SERVER/path.
For SMB, smb://user:password@SERVER/sharename/folder

You cannot currently browse to SMB shares if using the latest version of the SMB protocol. Neither does Kodi give you a user/password dialog. This is a major drawback since newer versions of Windows don’t seem to allow passwordless (Guest) access to shares. You will have to enter the user, password and location manually or temporarily change the SMB settings from their defauilt (see below).

SERVER is the name of the server machine, or preferably an IP address. If using an IP address, it’s best to make it a fixed address by telling your router to always assign that address to that machine. If you do use a Windows machine name, it must be in UPPERCASE. user is a Windows username with access to the share and password is that user’s password. Path is the location of a share in a Linux filesystem on the server, sharename is the name of a Windows share. path and sharename are optional – without them you would see all visible shares on that machine - folder (also optional) is the path to a folder inside that share.

If using UPnP, you must use the browse function.

To turn on browsing and password entry for SMB, you will have to force both client and server to use SMB version 1. There is a security risk in using SMB1. Do not leave SMB1 enabled if you also want to access your files from the internet. In Windows, search for Windows Features and enable SMB 1.0/CIFS File Sharing Support.
image

In OSMC, go into Settings, set the Settings level to Advanced or Expert and set the Maximum protocol for SMBclient to SMBv1 or None.


Now you should be able to see the shared folders on the Windows machine after entering a valid username and password. Once you have added a share or shares to the Library, you can (and should) go back to SMBv3 (on both machines) to restore security.

OSMC as a client – using fstab or autofs

Using the SMB or NFS services in Kodi is somewhat simple to set up but may not deliver the best performance. It may be fine for music and low-resolution video but not for high video bit-rates. For that you have to ‘mount’ a shared folder in OSMC’s filesystem. You will need to access the commandline as described here: Accessing the commandline.

You make a directory in the filesystem then attach the shared directory to that ‘mountpoint’, usually under the /mnt directory. The share can be mounted automatically by editing file /etc/fstab.

Warning - we have been recommending using fstab for years, and it’s fine when accessing a server which is always on. If the server can go offline (eg a Windows desktop that gets turned off or sleeps) then use autofs as described here: [HOW-TO] Mounting network shares with autofs (alternative to fstab). Autofs automatically handles creating the mountpoint(s).

Mounting using fstab is described here: Configuring fstab based Samba share mounts or here: Configuring fstab based NFS share mounts

When mounted, the shared directory looks to Kodi just like a local directory so you need to browse to Root filesystem then the mountpoint when adding a media location (source).

OSMC as a server

To share files on your OSMC device with other devices proceed as follows. You can use NFS, SMB or UPnP. If sharing a USB drive or other removable media it first needs to be mounted in the filesystem. OSMC automatically mounts removable devices under the /media directory and automatically shares them if you have installed the SMB server (see below).

To share using NFS you need to install the nfs server:

sudo apt-get update
sudo apt-get install nfs-kernel-server

For NFS do not rely on the built-in automount which mounts removable drives under /media. Instead, add a line in fstab to mount the drive under /mnt so that its location and shared name is predictable. First make a directory under /mnt. Lets call it mySharedDrive.

sudo mkdir /mnt/mySharedDrive

Type blkid at the command prompt to get the UUID of the partition you want to mount. You will see something like this:

/dev/sda3: LABEL="OSMCsystem" UUID="db216be0-6d8e-45b6-97ad-0fd806e961dc" TYPE="ext4"

Then edit file /etc/fstab (sudo nano /etc/fstab) and add a line to it like this

UUID=db216be0-6d8e-45b6-97ad-0fd806e961dc /mnt/mySharedDrive ext4 defaults,noatime,nofail,x-systemd.mount-timeout=30 0 0

but using the value of UUID for your partition.

Mount it with sudo mount -a

Use nano again to make a file /etc/exports which will contain lines like this:

/mnt/mySharedDrive 192.168.1.0/24(sync,no_subtree_check)

and then type exportfs -a

In the example, the drive mounted at /mnt/mySharedDrive is shared with any device on the 192.168.1.x subnet. Access will be read-only by default. For other sharing options refer to linux documentation for exportfs.

Windows machines (Pro, Ultimate and Enterprise) can access NFS shares by adding the NFS client.

image

It is not possible to browse to an NFS share from Windows but you can go there by entering the location eg \\192.168.1.1\mnt\mySharedDrive in Windows Explorer and you can map a Windows drive letter to that NFS shared directory.

To share OSMC’s files using SMB, install the Samba server from the AppStore. The server automatically shares your home directory and any removable media. OSMC’s automount feature and Samba use the partition LABEL (see above) as the mountpoint and share name. Make sure you set that to something recognisable when you format the drive. Configuration files for the server are in /etc/samba. If you want to change the SMB version or other defaults, create a new file smb-local.conf as described in smb.conf. OSMC’s samba server by default will support any SMB version. To browse to the samba shares from Windows, turn on the SMB 1.0/CIFS Client in Windows features. To force a more secure protocol, add server min protocol = SMB2_10 to the [global] section of smb-local.conf. You may find adding lanman auth = yes and ntlm auth = yes necessary as well.

To share using UPnP/DLNA turn this option on in Settings->Services. Other devices will then be viewing your media through the library rather than directly through the filesystem. They will only be able to access media that you have added to the library, therefore.

8 Likes
Unable to connect to a network share via smb
SMB not accessible
How do I mount Windows network shares in OSMC?
Configuring fstab based NFS share mounts
Access to SMB Share - Error: File exists
Not even my WORKGROUP is browse-able when trying to add SMB source
SMB not accessible
How do I share a folder from OSMC (RPi) mounted drive to read write file from Windows laptop
Cannot connect to SMB shares
Should my new Vero 4K see my Windows network?
First comparison between Vero 4K and my Intel NUC
Connecting Vero4k+ to synology nas
I want to mount my wd my cloud personal 3 tb nas on osmc installed raspberry pi 2
Share USB drives to local network? (Samba installed but can't see Vero on LAN)
Cannot connect to SMB shares
Vero can't see Windows 10 shares
Questions on my new Vero4k+
Shared storage of media info, watched (etc) for multiple Vero4k+
Windows 10 Fall creators SMBv1 fix
Raspberry & Mycloud NAS failures
NAS or USB 4K 60-70GB files?
OSMC, Unraid server
Sharing files with Windows PC via Samba?
Adding Repos
Interrupted Video playback on vero 4K
How do I mount Windows network shares in OSMC?
Time Capsule Connection
Vero 4K+ not turning on
OSMC samba network
Setting up Vero 4K+ basic questions
Question about media servers
Vero 4K and playing files from shared folder on Windows desktop
The Hurricane Heist 4K playback problem
How do I share a folder from OSMC (RPi) mounted drive to read write file from Windows laptop
Access NFS directory from Windows Server
Mount an external USB drive
Raspberry 3 - SMB not working
OSMC + Synology (with username and password)
Mounting SMB via fstab - Help
Mounting SMB via fstab - Help
[Solved] Add Network Location problem Vero 4K
Instructions for idiots
Help please for beginner who cannot play video files
Help needed: Setup video source
Can't access Vero 4K/OSMC from Windows
Vero 4k cant see my server
Vero 4k cant see my server
Some questions Vero 4K
Question about Osmc and options
File sharing
SMB is empty
'Couldn’t connect to network server'
Play content from another multimedia
New out the box
Vero 4k stuttering suddenly
SMB logon failure
Connect to Synology via Wifi to access files
Connect to Synology via Wifi to access files
Noob help with connecting to NAS
Noob help with connecting to NAS
Vero 4K+ cannot connet to PC Win 10
Vero 4k+ & SMB on win7: Errdos ERRnomem error
Samba Sharing
[SOLVED] Can't access OSMC with windows explorer
Can't access Vero 4K/OSMC from Windows
How do I connect my WD nas drive to my Vero 4k & see the files on there
Sync and video questions
Can I ask a few Q's please?
Just received my Vero 4K! A few issues though.
Best solution for playback trough MS Windows share
Vero 4k+ stuttering for 4k video 30ish + FPS
Super-noob, access Very 4K+ over network
Vero 4K RMA requested
Vero 4K RMA requested
Please Need Help With RPI And SMB
#2

Bug since January 2018

There are reports of problems streaming video from NASs when the maximum protocol on either the NAS or in Kodi (or both) is set to SMB2. This seems to affect only Vero4k and only when connecting through Kodi (not when using fstab).

If you get this problem, set your NAS and Kodi client to SMB3. If your NAS does not support SMB3, try ‘SMB2 with large MTU’ or similar. If that doesn’t work, set the Kodi client to max SMB1.

This should be fixed in the next update.

1 Like
#3

This bug has been fixed.

1 Like
#5

hi, what about webdav? how should i map a webdav drive in OSMC? thanks in advance

#6

Why do I rarely, if ever, see anyone recommending an FTP or SFTP server? It’s blazingly fast, moreso than NFS methinks.

#7

FTP will be fast
SFTP will be quite slow

Sam

#8

Admittedly I haven’t tried SFTP, but my FTP server streams 4K well. Is the speed of SFTP somewhere in between SMB and NFS?

#9

It’s quite slow. I’d rank it as bottom of the pile.

Sam

split this topic #10

9 posts were split to a new topic: Problem sharing ntfs disc with nfs

Problem sharing ntfs disc with nfs
#11

Hi guys. I’m new in this. I try to access my windows files using UPnP. I think i´m doing it all as you taught, but after adding the source, I open it and there’s nothing to play, it´s empty.
Can someone help me please?

#12

You need a UPnP server on the windows box. I’m not sure if Windows itself provides this by default for your Music and Videos library.

Problem sharing ntfs disc with nfs
#13

Personally I’ve completely given up with trying to connect OSMC to my Synology NAS. I’ve tried lots of options, and followed lots of instructions (some of which would have opened my NAS up to just about anyone!) I got a Roku box, and it just connected to my NAS, no dramas. And it didn’t cost any more than a Raspberry Pi. Sorry, I’ve thrown out OSMC! These things are dead until they are made more usable. You shouldn’t need to a Linux guru, or a network engineer, to use them. And that’s where Roku wins hands down … you plug it in, it finds your NAS, and you USE it rather than spending days tinkering with it!

#14

That’s a shame. UPnP should ‘just work’ exactly as it does on Roku. Maybe I should put that option right at the top.

#15

Using g synology nas ds416j via shared folders and setting up nfs shares. Didn’t need all of this stab etc stuff as it’s a little too far for myabilities.

Havent tried the on board synology apps as nfs is fine. Happy to check synology shared folder nfs settings etc.