Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File transfer hurdles in .net using mono on linux to windows file share

Tags:

c#

.net

mono

smb

cifs

I am writing a .Net application to transfer files between linux and windows. I use mono to achieve platform independence.

I used https://code.google.com/p/cifsclient/ as a reference(Thanks Jordi Martin). His awesome solution is similar to what I am trying to achieve.

I am having a hard time to transfer a file from Windows share (file resides here and shared with "EVERYONE") to a linux box (where my application is running on mono)

One way to solve the problem is by mounting the shared windows folder on linux. Unfortunately, I don't have the root credentials, so mounting is difficult. Second way is, changing the file url to smb://fileSharePath in turn using the auth token (initialized with windows credentials as smbclient_init) In-spite of the token having proper creds, subsequent access requests fail. Third way is to prepend the fileSharePath with "net use" suffixing the win creds, but that craps out too. http://social.msdn.microsoft.com/Forums/vstudio/en-US/03bf0cf2-be80-43a4-870c-83727dee1c63/access-a-samba-share-via-c?forum=csharpgeneral

To summarize, I don't have the username/password of the windows share or the root creds to the linux machine on which my application is running. I don't have a spacial service viz. ftp, http, etc running. Is there a way to cover the scenario of transferring files from linux box to windows file share and vice versa?

Any help would be greatly appreciated, I have been fiddling around this for a week but haven't come up with a good solution.

Thanks in advance,

Shoeb

like image 470
CodeShitter Avatar asked Jan 04 '14 00:01

CodeShitter


1 Answers

What about just using NFS Sharing which windows supports? https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc976863(v%3dtechnet.10)

like image 62
sean Avatar answered Oct 15 '22 20:10

sean