Samba automount template not working

The reason it’s not working with a different username is because the user permissions for the automount shares are not actually set in smb.conf. The automount shares are created dynamically on the fly using the samba ‘net usershare add’ command which is run by udisks-glue when removable disks are detected. This is controlled by /etc/udisks-glue.conf:

You’ll see at the end of the line $(hostname)\osmc:f - this gives the osmc user full read/write access. Anyone else won’t have access.

When I devised the automount share system in RC3 I didn’t consider the use case of trying to set permissions for another user - the problem is that although the [automount template] in smb.conf can be used to provide additional properties for shares created this way, you can’t override the access permissions.

You could edit udisks-glue.conf to change the user permissions for the shares (note that there are multiple copies of the scripts that must all be changed) however updates would overwrite your changes.

Another possible approach is to simply create another share under a slightly different name with your custom user permissions, as I don’t think you can override the existing share in smb.conf.