Running a command via SSH on the Mac causes exception; works fine when directly connected
I found that I needed to unlock the security keychain:

Mac-mini:~ gravelld$ security unlock-keychain
password to unlock default: 
Mac-mini:~ gravelld$ codesign -s "Developer ID Application: My Name" -f /path/to/appfile/mounted/elsewhere.app
/path/to/appfile/mounted/elsewhere.app: replacing existing signature
Mac-mini:~ gravelld$ 


Success! Hope this helps someone.