# File exchange between windows guest and jail



## abishai (May 3, 2017)

Hello, I need a shared folder between Windows (bhyve guest) and jail (on the same host). 

What should I choose if I don't want to install additional software on the host itself (I suppose this mean no NFS as NFS never was jail friendly).

I have some proprietary windows software that uses IN and OUT folders for remote control.


----------



## SirDice (May 3, 2017)

Samba would be the obvious choice. Although I do remember there are some caveats with Samba running inside a jail but basic file sharing functionality should work.


----------



## abishai (May 3, 2017)

I never used samba and it looks scary with it's DC functionality.  Usually I use Nextcloud to transfer my own files between windows and unix.
I hope it would be easy.
Why there are so many sambas in port tree ?
http://www.freshports.org/search.ph...leted&start=1&casesensitivity=caseinsensitive
Which one should I pick?

Is it good idea to grab older version ? http://www.freshports.org/net/samba36/ It doesn't have DC features and looks smaller.


----------



## SirDice (May 3, 2017)

abishai said:


> I never used samba and it looks scary with it's DC functionality.


No need for all that. A basic server configuration will do just fine (it will function as a stand-alone Windows server).



> Why there are so many sambas in port tree ?


Because we like choice 

We started off with just one version, then new versions were released and the 'old' versions are still kept around because they're still supported versions and people may not be able (or don't want) to upgrade to the latest version.

For new installations I would recommend starting with the latest version: net/samba46.


----------



## abishai (Jun 22, 2017)

I have an issue with samba. When I alter existing file on FreeBSD filesystem, changes are not reflected on Windows client. Seems like file content is cached. How can I overcome this problem? Samba is compiled with FAM option.


----------



## aragats (Jun 22, 2017)

Depending on your actual purpose there exist other options too. E.g. I rarely need file exchange, so I let net/freerdp do the work, it can "map" a directory to Windows:
	
	



```
$ xfreerdp -grab-keyboard /bpp:24 /w:1800 /h:1200 /v:$HOST /u:$USER /p:$PWD /clipboard /drive:home,/home/$USERDIR /fonts /sound:sys:oss,dev:3 /microphone:sys:oss,format:1
```
Of course, you may not need all those options with sound etc., check the man page xfreerdp(1).


----------



## abishai (Jun 23, 2017)

I need to organize file data exchange between daemon and windows program. daemon is writing a line into file, windows program is reading it.


----------



## SirDice (Jun 23, 2017)

Is the Windows client only reading? Have you considered using a basic nginx or lighttpd configuration to serve that file?


----------



## abishai (Jun 23, 2017)

SirDice said:


> Is the Windows client only reading? Have you considered using a basic nginx or lighttpd configuration to serve that file?


No, it reads one file and logs result into another one. Daemon should read out file. I can choose existing folder and file names in application settings. Probably, I can copy files in and out using something like scp client for windows, but hey, it's a huge overcomplication. I can't believe that simple file sharing between unix and windows can be so dramatic.


----------



## aragats (Jun 23, 2017)

If you have an Enterprise version of Windows, it supports NFS out of the box (you have to enable it though), works very well. If it's not Enterprise, there exist some third party NFS clients, e.g. FreeNFS.


----------



## abishai (Jun 23, 2017)

Is NFS works on jail ? I remember rpcbind had issues, at least some time ago.
I asked penguin friend and he confirmed the issue under CentOS7 + Windows 8, but not with Windows 2003, so this is not FreeBSD only. I think samba options are not exhausted, I'll try to disable SMB2


----------



## aragats (Jun 23, 2017)

Instead of running a samba server in FreeBSD why not using Windows SMB shares by mounting them in the jail.


----------



## abishai (Jun 25, 2017)

I wrote my own implementation with sockets and integrated it into my daemon. It's not only faster, but also I have full error handling within daemon.


----------

