2

I have a smb share on a Linux box set up that I can view in explorer:

\\XXX.YYY.ZZZ.QQQ\Share

In this share is a batch file:

\\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat

I can open the file in Notepad from Explorer, using right-click "Edit", and even edit the file.

If I double click on the batch file in explorer, or if I have a shortcut to the file on the desktop, I'm initially prompted with a "Open File - Security Warning", but when I click "Run" I get an error message:

Network Error

Windows cannot access \\\\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat

You do not have permission to access \\\\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat. 
Contact your network administrator to request access.

The odd thing is that if I open a cmd window and simply type "\\\\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat" the script runs with no problems.

  • 2
    I can't say much for Samba shares, but I do know that batch files don't really run the way you would think from a shared network location. First of all UNC paths are not truly supported in batch files, so most of the time, people will map the drive to the file and then execute from the mapped drive (you can also use PUSHD and POPD for this). As for why this runs from cmd line, I have no idea. Just a thought. – Get-HomeByFiveOClock Dec 3 '14 at 21:52
  • 99% sure this is a permissions issue that changed with recent versions of bind...just to test can you try running a .exe file from the share? – Grant Dec 3 '14 at 22:38
2

Starting with Samba 4 the execute permissions on files is enforced. The old behaviour with windows clients was to allow execution regardless. Windows actually opens the file slightly differently if it is executing it vs. just reading it - which is why you can print the file without any issues.

Either set execute permissions on the file or add this option to the share:

acl allow execute always

That will restore the old behaviour of allowing any executable to run.

See this bug report for more details.

| improve this answer | |
  • Thanks. I eventually found the same setting and now everything works. – Benjamin Peikes Dec 4 '14 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.