Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy file from linux to windows share with C# (.NET core)

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.

like image 234
Pandora Avatar asked Oct 18 '17 18:10

Pandora


People also ask

How do I transfer files from Linux to desktop?

Use the cp command to copy files in the Linux terminal. To copy a file on a computer with a graphical interface, you usually either drag and drop a file from one window to another window, sometimes using a modifier key.

How to copy a file from Linux to Windows?

To copy a file from Linux to windows, you have to create a new folder, i.e., “Share,” in the home directory, as shown below. Right-click on it and tap on “Properties.” Expand the ” Local Network Share ” section within the Properties dialogue that appeared on your screen, expand the “Local Network Share” section.

How do I transfer data between windows and Linux?

To transfer data between Windows and Linux, simply open FileZilla on a Windows machine and follow the below steps: Navigate and open File > Site Manager. Click a New Site. Set the Protocol to SFTP (SSH File Transfer Protocol).

How to share files between windows and Linux computers?

Once connected, you can simply drag-and-drop all the necessary files between Linux and Windows machines. Making a folder accessible over a network is the most straightforward approach to share files between Windows and Linux machines. However, this approach is fundamentally different from others.

How do I transfer files from windows to Linux using SFTP?

Set the Protocol to SFTP (SSH File Transfer Protocol). Set the Hostname to the IP address of the Linux machine. Set the Logon Type as Normal. Add the username and password of the Linux machine . Click on connect. Once connected, you can simply drag-and-drop all the necessary files between Linux and Windows machines.


1 Answers

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/

like image 191
Nick Edwards Avatar answered Oct 20 '22 13:10

Nick Edwards