Liam
Liam

Reputation: 20970

How do I access a Linux Samba share from a Windows Service?

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?

Upvotes: 3

Views: 4115

Answers (2)

Liam
Liam

Reputation: 20970

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

Upvotes: 1

Eoin Campbell
Eoin Campbell

Reputation: 44306

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";

Upvotes: 0

Related Questions