Hi there,
We seem to be having issues trying to SSH into devices with SSH enabled on a backdoor local admin account. This issue is only apparent when trying to connect over the internet to a host with SSH enabled. When that device is on the same local network I'm able to SSH fine without issue.
I've tested multiple machines in the environment and issue is exactly the same on all machines.
This is the script used to enable SSH on the target device:
#!/bin/sh
ssh_user="THE_USERNAME_OF_THE_ADMIN_USER_ACCOUNT"
# turn ssh on
systemsetup -setremotelogin on
# append user to ssh group
dseditgroup -o edit -a $ssh_user -t user com.apple.access_ssh
# restart ssh
launchctl unload /System/Library/LaunchDaemons/ssh.plist
sleep 5
launchctl load -w /System/Library/LaunchDaemons/ssh.plist
exit 0
And connect in Terminal using 'ssh THE_NAME_OF_THE_ADMIN_USER_ACCOUNT@targetIp'