If your Samba logon script does not get executed

… even though you can open and read it fine in an editor:

You should check its Linux access permissions. If it is not marked as executable, this might be the cause.

Change it with chmod like this:

root@server:/home/netlogon$ ls -la
total 12
drwxrwxr-x+  2 root root 4096 Apr 13 09:04 .
drwxr-xr-x  46 root root 4096 Mar  6 12:08 ..
-rw-rw-r--   1 root root 2535 Mar  6 14:32 logon.cmd
root@server:/home/netlogon$ chmod +x logon.cmd
root@server:/home/netlogon$ ls -la
total 12
drwxrwxr-x+  2 root root 4096 Apr 13 09:04 .
drwxr-xr-x  46 root root 4096 Mar  6 12:08 ..
-rwxrwxr-x   1 root root 2535 Mar  6 14:32 logon.cmd

The same goes for other executables on Samba shares.

In my case this was the last known problem left from a recent server migration. It worked before, didn’t work after. Something changed with the Samba configuration or maybe it was a change in Samba itself.