How do I access a Linux Samba share from a Windows Service?
-
08-07-2019 - |
Question
I'm writing a Windows Service in C#. I have a samba share on a linux server that I can browse/read/write from the windows machine, and I have it mapped to a drive letter. The Windows service is running as the SYSTEM user and cannot write to the share.
What should I change?
Solution
I used an entry like this in my samba configuration file (smb.conf) to make it writable by any user.
[myshare]
comment = My Share
path = /home/myusername/myshare
public = yes
writable = yes
#maps all users to the nobody user?
only guest = yes
OTHER TIPS
You need to either make the share visible to the System User. or install the service as a User other than the Local System Account that actually has permission to browse the share.
You can change the installation account in the Project Installer by setting the following 2 properties. (it's in the ProjectInstaller.Designer File
this.serviceProcessInstaller1.Username = "DOMAIN\\UserName";
this.serviceProcessInstaller1.Password = "Password";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow