Windows – Allowing scheduled tasks to access a share requiring a username and password

network-sharesambawindowswindows-server-2008windows-server-2008-r2

I have a share setup using samba which requires username/password combination to access the files kept on it.

The script that needs to access this share is running on a windows server as a scheduled task (as a service account) and therefore there is no interactive session present.

I do not want to add steps to the script to mount the share as a drive letter or access it over a UNC path as this will require putting the username and password for the share in clear text in the script. Not great for security.

Does anyone know of a method of mounting a windows(samba) share permanently for a particular windows user so that scheduled tasks running as that user can access the data without the script having to mount it each time the script runs?

I don't want to remove the user/pass authentication to the share and I don't want to put the user/password in clear text in the script itself.

Thanks,

C

Best Answer

It's not clear to me whet ever this is an option to you, but this is what I do on my Windows machines and Samba-based NAS:

  1. Create a local account on the Windows box, with the same username and password as needed to access the Samba share
  2. Run the task using the newly created account. It should be allowed access.