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
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:
The only real solution(s) available to you:
1) Join your linx machine to the domain, and grant a domain user rights on that share. On your windows system, have the scheduled task run as that user. A bit heavy and very ugly if you're happy with your system setup overall (except for this one issue)
2) use something like SCP and SSH Key authentication, which eliminates username/password. PuTTY is a nice freeware SSH/SCP client. A quick googling gave me these rules, most of which look approximately correct (pick the one that makes the most sense to you)
http://www.google.com/#sclient=psy&hl=en&source=hp&q=ssh+key+authentication+putty&pbx=1&oq=ssh+key+authentication+putty&aq=f&aqi=g-e1g-b2&aql=&gs_sm=e&gs_upl=3790l4650l0l4808l6l6l0l0l0l0l250l1085l0.1.4l5l0&bav=on.2,or.r_gc.r_pw.&fp=d8edafa9e328c069&biw=1480&bih=933
I found this question while looking for how to mount a share from a script. I see that you have qualms about writing the password in the script, but for anyone who doesn't, the command you want is
net use
.