10

I'm using .NET core for an application running on a Linux machine (a docker container, to be exact)

How can I copy a binary file from there to a windows network share (including username & password)?

All solutions I've found were windows specific, but nothing related to Linux.

Pandora
  • 233
  • 1
  • 6
  • 15
  • Hi @Pandora, would you be so kind as to share any code you used to solve this, please see my question here: https://stackoverflow.com/questions/48957687/write-file-to-windows-machine-from-linux-net-core-service – Brian Ogden Feb 23 '18 at 23:36

2 Answers2

4

How about by using CIFS from Samba to mount the share. Once you've installed cifs-utils, you could try something like:

 mkdir ~/localMountPoint
 mount -t cifs //server/share ~/localMountPoint -o user=myname,pass=mypassword

There's a more in depth tutorial here: https://www.howtogeek.com/176471/how-to-share-files-between-windows-and-linux/

Nick Edwards
  • 630
  • 8
  • 18
  • 3
    Thanks Nick! Sure - that's a way to do it, have already thought about that. I was just wondering, if there is any code-based solution too? Would be interesting. – Pandora Oct 19 '17 at 08:52
0

apt-get update && apt-get install smbclient -y

smbclient //IPADDRESS/shared -c 'put myfile.txt' -U mydomain/username%password -m SMB2

Using P/Invoke

praveenSri
  • 11
  • 1