I want to be able to unlock screen, or login to physical user while I'm connected with ssh connection. I know this might be unsafe etc. However that's ok for me at the moment. What options do I have to do this?
I would be shocked if this existed since who would want their locked machine to exit the security without doing what is expected - TouchID or typing the correct password.
For code and API - check out our partner site Stack Overflow - the API to lock a screen is documented there and you might find official Apple developer API and SDK at https://developer.apple.com
The duplicate link I added has some really good Apple Script options.
$ osascript -e 'tell application "System Events" > keystroke "verysecurepassword" > key code 36 > end tell'
I might also suggest using
LockScreen. It's a hidden application that comes preinstalled and is protected by System Integrity protection. It will put a lock icon on the screen, lock the keyboard and mouse, and freeze the Touch Bar (Sounds malicious, right?).
System Preferences > Security & Privacy > Uncheck "Require Password...."
To lock the Mac use
- To unlock the Mac use (non tested but should work)
$ killall LockScreen