简体   繁体   中英

Write to a file present in Linux system having a Samba server from a windows system

I need to write to a file present in Linux system having a Samba server from a windows system through C# code. I am just in the stating phase of evaluation, so I don't have a linux system with samba server now to test my code. I found 2 useful links which fits my scenario very much. http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/03bf0cf2-be80-43a4-870c-83727dee1c63 and How to read shared file from Ubuntu/Samba using C#?

Now my problem is : My C# application is not fixed at particular system. Its a desktop application which can be present in any system across domains. Do I need to pass 2 username/passwords ? 1 for unix system and 1 for windows(client) system? How do I do that through code?

If it is possible for you to configure your Linux as you like, then you can configure the SAMBA share so that it doesn't need a username or password at all. This has the drawback that anyone in the network can write and read your files.

If you use the UNC path of the samba share (eg \\\\IP-address\\sharename) than you don't need to do anything special you can use the normal c# file system functions to access files by the UNC path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM