Windows and Linux......playing together

I am posting this in this forum, because the noise elsewhere is deafening. I hope it works!

If I am starting from scratch…with a Windows server and an OSMC/Kodi client, what is the recommended way to set it up to be able to read and write bi-directionally between the two? I have found these posts:

But frankly, I am behind the curve. I have only used OSMC via the Plex for Kodi Add-On, It mostly works, but I’m not convinced that the add-on will exist forever and need to understand the Kodi/OSMC infrastructure better. I have managed to get a Kodi box connected to my Windows10 server before without PforK add-on, but it was a nightmare.

If I have the Win10 box running and it is my server…and will be for the foreseeable future…how can I make them play nice? I want to be able to make them both readable and writable from either direction. \server\share with all rights, ideally with the ability to simply browse each other. Once that can happens I know that setting up the OSMC/Kodi will be relatively academic, but I need to better understand the dynamic. What is needed on each type of client to make this more seamless?

Appreciate the help!

Here is where I get confused and where you need to provide more details.
Are you planning also to store files on OSMC? Or you mean you just want to access/browse the Library on OSMC while all the files are on your Win10 Server?

1 Like

I store my files on my window server. I don’t have much of a choice there because that server not only holds my media but it stores all my data and is continuously backed up to the cloud via backblaze which has no Linux option.

However, my question is multi-purpose. I not only want to be able to set up my OSMC clients to access my windows shares, but I’m hoping the answer will be generalizable so I can use it on other Linux boxes for other purposes. For example, I want to be able to access folders on a Pi for getting or modifying files from a windows computer. I want the ability to have my Linux clients write to shares on my window server for things like log files.

If I can figure out how to do this reliably and easily there are probably lots of purposes this can serve. I have just heard so many terms thrown around like SMB, fstab etc. my past experience has not been good. Lol

That’s quite easy, just install the Samba Server from the MyOSMC - AppStore. Then the OSMC box becomes a Samba Server and can be accessed from Windows. While this will only give you restricted access to the OS files you should use SFTP to access those if needed.

From my experience the most stable and flexible way for that is using autofs using SMB following this guide

Well you may can ignore learning most of them and just follow the HowTo’s but it might not be bad to google some of them:

SMB (Server Message Block) is a networking protocol mainly used natively by Microsoft for network file sharing. Samba is a free implementation using SMB to act as a server (e.g. on linux).

FSTAB (File Systems Table) is a fundamental part of Linux that tells the operating system which filesystems (Harddisk or Network) to mount (where and how). For long the fstab was a central part for this. In modern times where filesystems became more “flexible” (USB sticks, Network FS,…) there are also alternatives to the fstab like the autofs solution we explained above.

1 Like

Before you start make the ip address of the Windows PC and OSMC device static. It is preferred to do this in your routers dhcp settings.

Make a new user profile to avoid having to store your real Windows password in plaintext.
Open a command prompt in Windows in admin mode and type

net user username password /add

Setup your Windows shares
For each folder you want to share right click, properties, sharing, advanced sharing, share this folder, permissions, give full access to the everyone user group. In the security tab, advanced, change permissions, the user will probably not be there so you would need to add it and in the adding dialog you would select a principal, advanced, search, choose the user you created, ok, and then give full control or whatever you want the access to be.

Optional
Windows settings search for “windows search settings” and in that section click on the “advanced search indexer settings”. In this settings pane you can add in the location of your media files to the search indexer. This will speed up library updates considerably.

Kodi clients
In Kodi go to videos>files>add videos>browse>add network location> and select SMB, add the ip address of your windows PC (and nothing else) in the “server name” field and the username and password from the new account you created in windows and then click OK. This will give you a new network location that is browsable so all your sources can just be added with videos>files>add videos>browse>[PC’s ip address]>

Alternatively you can add system mounts instead as mentioned above. You can also at any point add a system mount and redirect to using it with an existing library that was setup with Kodi SMB paths via path substitution.

Accessing OSMC from Windows
After installing SMB server from My OSMC from your windows box bring up a file explorer window (win+E) and in the address bar type in \\[ip address of OSMC] and hit enter. Windows should popup asking for credentials. type in “osmc” for both and click the box to save credentials. It should not ask for it again. You should at this point be looking at the home folder on the OSMC box. You can right click on the osmc folder there and click copy and then on your desktop (or wherever) right click and select paste shortcut for quick access. In the same vein if you need to ssh often you can right click on your desktop (or wherever) new>shortcut and set the path to
C:\Windows\System32\cmd.exe /k ssh osmc@[ip address of OSMC]

(there might be some slight errors above as it just kind of went through it mainly off the top of my head and typed it out)

3 Likes

Is this possible via SSH? I know that may seem overly ambitious, but the OSMC system is running in a setup that my son is currently using, but with the Shield so I can’t get to the screen. (yes, we (my special needs son) get up early in TX)

Also, is there an analogous (or same) package for vanilla raspbian/Debian in case I want to use this knowledge for a non-media client?

I’m actually not a complete newb when it comes to the definitions and their basic function. It’s more about understanding the dynamics of what works best in this context and I have very little experience with that since I have been a Windows baby with my primary Linux experience coming from small tweaks to the various, purpose-built images I have tried over the last couple years like OSMC, OctoPi, etc.

You can try sudo apt-get install smb-app-osmc

Yes, just the standard samba server. The OSMC package is basically that plus a special config file that allows sharing of automounted files.

Easy stuff. It’s not even static, it’s reserved in my UniFi environment.

I actually already have a basic user set up for this purpose on that server. I did it through the GUI User Manager, but same difference.

Already done for this as well. I have a lot of Windows clients on my network already that all interact. My “server” (which is really a Win10 box) is also my file server as I mentioned so my wife’s system and my son’s system all save files to it for appropriate automatic backup.

I think this is set already, but I will double-check it. Good one!

This is something that has always killed me in Kodi…the distinction in the Kodi menuing system between sources and folders…and how they appear in the interface. It’s like I have a mental block on this for some reason. lol

THIS is the nitty gritty…I think. I believe what you are talking about is creating mounts in the underlying Linux instead of within Kodi, which Kodi then can see as network locations? Am I thinking of that correctly? If so, please elaborate! It could be useful for my general Pi playing outside of just watching media!

I have been able to do this in the past, but always seemed to have issues where it would only work for that session or it would mysteriously allow me to write one day, but not the next. I never could figure it out, but I will go through this again.

For SSH I use Putty which of course keeps a list of saved servers for me. I actually didn’t know you could SSH via the CMD prompt in Windows. I may try it just for fun now!

What does that mean? What is an “automounted file” and does that apply to directories as well? For example, if I can access a directory on the OSMC (or any Linux box for that matter) will it give me the same rights and permissions as that OSMC user has locally if I access it via SAMBA?

That means if you plug in a USB Disk into OSMC it will be automatically mounted and then shared via SMB.

Yes if you login samba with your OSMC user you will have the same access permission as locally on the machine.

It sounds like I’d want to use this package on all my Linux systems! What’s the downside…if it helps with dealing with things like USB drives…of which I will certainly have in some cases!

In trying this I’m being reminded of one of the issues I had in the past. It doesn’t take my credentials in Windows Explorer even though I can log into the same box using the same credentials in Putty or CMD and it works fine. Is there some sort of config that has to be done in the Samba server to make this work once it’s installed?

OK…I had changed the password on my OSMC system to different than the default. That new password is working fine via Putty. However, in Windows Explorer I tried the default “osmc” password and THAT works. How is that possible?

The Downside is that package is specific to OSMC.
You could try to manually copy he config files to you other Linux systems.

They are different passwords that are not syncronized.
The Samba Password is changed with smbpasswd

1 Like

Is there a comparable functionality in the generic Samba server package? I am certainly going to be using USB drives in some cases. For kicks I just plugged in a thumbdrive, refreshed my Explorer window and it showed up! I’m excited!

Where are such config files located? I’d like to look at them. Are such files able to be added to the standard Samba server as well? Is that where the autofs-vs-fstab thing come into play?

Does “specific to OSMC” mean that to make this work seamlessly I’d have to add the OSMC repositories to a non-OSMC box and if so, would it break anything else using just that package from OSMC on other Debian-based builds?

I appreciate your candor over coffee! once my “normal” workday starts it becomes less easy for me to do this kind of stuff!

PS: I wish Win10 supports NFS. From what I have read it makes this sort of thing far more seamless…

Yes, it’s just a question of the configuration of the samba server. While your OS also need to support automounting (all modern Linux Desktop OS do so).

/etc/samba/

No just need to adapt the config files to the specifics of your OS.

Well there are client/server solutions for Windows but they are not Native.
So yes NFS is native to Linux while SMB is native to Windows but I believe in a mixed Linux/Windows environment SMB is still the better choice.

They are one and the same. In your dhcp server you are “reserving” a specific (ie static) ip address that it will only give to a network interface with a specific MAC address. This is opposed to a dynamic ip address wherein there is a pool of available ip addresses that get handed out on demand and as such what is given to any device will likely change from time to time. Although this is not strictly necessary as you can use host names instead of ip addresses, it is less error prone in a home environment as you don’t ever have to rely on any mechanisms for host name lookups.

Although the end result is mostly the same, with current versions of Windows 10 they make it a real pain in the taint to quickly add a local account. Banging out that single line in an elevated command prompt is a fraction of the effort.

Then why did you ask for “If I am starting from scratch…”? Your getting free support from people who are volunteering their free time to provide it. Focused questions save everyone time and effort.

A Kodi “source” is just a specific file path that is designated to be used as a media location. These would be analogous to Windows library folders where you have separate “special” folders dedicated to music, videos, pictures, etc. There isn’t actually anything complicated about them. You tell it to add one and point it somewhere. The procedure I outlined just makes it easiest to setup as it both allows for browsing SMB shares lacking NetBIOS and it adds credentials to Kodi for the entire machine instead of having to do it for every source.

If you create a source in Kodi to smb://somewhere then Kodi itself is handling the networking part of the communication. For most this is simple, effective, and all that is needed. This method is not the most performant though so one can optionally attach their network location in the OS and then point Kodi to the location its attached in the local file system. In this way the OS takes care of the networking part of the communication. In Linux this is called a mount and it is (very) roughly equivalent to mapping a file share in Windows.

This has advantages when you are lacking bandwidth such a a Vero 4K user trying to play high bit rate 4K rips through the fast ethernet connection. For anyone who isn’t getting buffering issues this usually is providing little practical benefit. The downsides would be more effort if you have to restore from a backup and if you are running various clients across platforms it makes it more of a hassle as you can’t just simply copy your config from one machine to the next untouched. I would also highly suggest Kodi SMB paths to anyone moving to a MySQL setup as they are the only source type that works across all platforms. And, as mentioned, you can use path substitution to switch at any point on any client.

The static ip and saving your credentials prevents this issue. In your Windows user settings there is access to your saved credentials. Take a look, it is pretty straightforward.

Supposedly Microsoft :heart: Linux now but until they add NFS support to Win Pro and contribute official SMB and NFS to Linux their declaration is a bit lacking. The built-in SSH client in Windows works fine and it is all I use. I did tweak cmd a bit to allow for a longer history and more readable colors.

1 Like

Yes and no. A static IP is coded in the client that way as well as the DHCP server potentially holding it aside. The client doesn’t even ask for an IP. In the UniFi/reservation paradigm, the client is still asking for an IP, but DHCP simply ALWAYS gives it the same one. I agree they are functionally the same, but with a reservation, I can update my DNS for example and the clients will get that update without having to manually modify any settings and it will still get the same IP…in theory anyway…:wink:

So, I agree that line of code is faster. I didn’t know that could be done, thank you!

As far as asking for help if I had done this already…it’s because on the Windows side I basically understand how to share stuff. What I don’t know is if that was the best way when it comes to a Linux client. I had used that base user for sharing to my other Windows clients prior to me ever using a Linux client.

On “starting from scratch” it’s because again…what I did may have not been the best way to do it. If I ask a group of more knowledgeable folks what they would do if starting from ground zero, some of what I have done may be good and some of it not. It’s really about better understanding what is happening here and for that I thank you all for the effort and help!

Thank you. I stopped trying to use Windows “Libraries” about 10 minutes after they implemented them back in Win8 or whatever it was, but I am familiar with the paradigm. What always confused me about the Kodi paradigm is that you set up a “Source”, but then you set up libraries under “Videos” if you want movies for example then you have all these crazy menu thingies in the interface to get to what you want…or you can create shortcuts of some sort that puts them on the home screen…maybe? I guess I have to just play around with it more. That’s one of the reasons I prefer the Plex paradigm.

I got this to work earlier. Something I didn’t realize is that the SMB server uses different credentials than the main user login…or they could be the same, but are not synched with the main user credentials so when I changed the osmc main user password I assumed that would apply to the SMB server as well…I was wrong.

I also use a hosts file in my main, Windows system that I work from all the time. Between that and reserved IP’s, I am able to reach these hosts via hostname and save my shortcuts appropriately. I am considering going back to a pi-hole for DNS, but it’s just on my “to do” list…sigh…

Again, thank you both for the help and time! I have learned more than you know!

An ip is either static or not regardless of how you get there. You can make it static via dhcp or manually set it on the device (hopefully outside of the range your dhcp server is handing out). There is nothing different about this that Unifi does vs anyone else. I say this as someone who is running a full Unifi setup at their house.

Your source defines a location for a media type (including none for a path you want to access but not add to a library). A single source can point to more than one location. You can also have more than one source for the same type of media.

You “set content” on a source which allows scraping which generates a “library” which is where all your media’s information is being collected in a database.

Everything to do home screens and extra menu options revolve around the library and the skin your using. Plex and Kodi are actually the same in this regard with the exception that Kodi allows you to change the look. Plex actually branched off from Kodi years ago. If your trying to relate sources to GUI stuff this would be quite confusing. The GUI is all about looking up from the database and sources are the entry to getting the information into this database.

You really shouldn’t have to be editing your hosts file unless you have naming conflicts on your network.

To be precise, you differentiate between Static IP and Static Lease. Static IP is configured on the Client, Static Lease is configured on the Server.

2 Likes

Precisely.

I did not want to argue about it, but if you take the client that has a reserved lease in the UniFi system and plug it into a completely different network running DHCP it will pull a different IP address on that network. The CLIENT is still DHCP.

Static IP is static. It’s “coded” into the client so if you plug it into another network it still has that same, manually set IP.