Coding with Titans

so breaking things happens constantly, but never on purpose

OSMC + SMB share with credentials

Yet another day I tried to play a video from an SMB share using OSMC. Must say so – this player is just amazing and works great on Raspberry Pi 2 (although on Pi 1 whole stack was far too slow for HD content). So what could go wrong here?

I am a bit paranoid about sharing and access rights. That’s why I setup that share with a dedicated user on a server and guarded with a strong password. The user could only list folders and read files, so even if the password gets somehow compromised, it shouldn’t allow to cause any harm on server. But then I couldn’t find the way of mounting such a share though GUI of the OSMC player. After several tries I wanted to give up until I found the way of updating configuration manually.

PC with SSH client is required for that purpose. Let’s connect to the device (default user and password are ‘osmc’, what I recommend changing just after player installation). Then all settings about mapped drives are stored in an XML file at “/home/osmc/.kodi/userdata/sources.xml”. Simply edit this file adding following snippet at respective place. Of course replace the ‘user’, ‘password’ and server IP with the real values from your environment.

<sources>
   ...
   <video>
       <default pathversion="1"></default>
       <source>
           <name>Prime</name>
           <path pathversion="1">smb://user:password@10.0.0.111/video/</path>
       </source>
   </video>
   ...
</sources>

Save. Reboot. Enjoy!