cfgutil no longer works via ssh after upgrading to Sierra
-
14-04-2021 - |
Question
I use the cfgutil
from Apple Configurator with iOS devices on an OSX host via SSH. After upgrading to Sierra, I get a NSCocoaErrorDomain message and it fails. It works fine at the terminal, however.
Here's my output of trying it successfully at a local terminal, then sshing and the failure:
~ cfgutil list
Type: [...] ECID: [...] UDID: [...] Location: [...] Name: [...]
~ ssh localhost /usr/local/bin/cfgutil list
Password:
cfgutil: error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.configurator.xpc.InternetService" UserInfo={NSDebugDescription=connection to service named com.apple.configurator.xpc.InternetService}
I assume this comes from some increased security measures from Sierra, but for me it's a pain. Any ideas how to disable this or work around it?
Solution 2
I've found a slightly better workaround now:
sudo /bin/launchctl asuser 0 cfgutil list
Don't ask me how it works, but I get expected output.
OTHER TIPS
I've found a very awkward workaround, though input is hidden:
- Create a file, e.g.
/tmp/cfgutil.sh
on the server - Populate that file with the command you wish to run, e.g.
cfgutil list
- When you ssh in, run
open -a Terminal /tmp/cfgutil.sh
Here's a minimal example:
echo "/usr/local/bin/cfgutil list" > /tmp/cfgutil.sh && ssh localhost open -a Terminal "/tmp/cfgutil.sh"
I suspect it only works if the user is logged in via the UI as well.