Saturday, February 5, 2011

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?

  • 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";
    
    Liam : Do you know how to make the share visible to the System User?
  • 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
    
    From Liam

0 comments:

Post a Comment