1

How can I login user in programmatically way?

I need something opposite to command

launchctl bootout user/502

that logouts user with id=502.

Does this way exist?

  • What are you wanting to do, once the user has logged in? – Graham Miln Mar 30 at 8:09
  • Copy some data. Without login this data won't be synchronised to the latest changes. – Rougher Mar 30 at 9:13
1

Not on macOS

No, there is no Apple supported programmatic way of logging in a user on macOS.

One approach would be to create a virtual smart card and simulate a user logging in. This would require significant effort and development time.

| improve this answer | |
  • I found some way. Connect through VNC in AppleScript. It works, but I search for more elegant way... – Rougher Mar 30 at 9:12
  • That is a clever approach for a computer you control. Be aware that VNC may not be over a secure connection and thus any credentials (username and passphrase) may be at risk. – Graham Miln Mar 30 at 9:29
  • 1
    That what I need: apple.stackexchange.com/questions/386654/… – Rougher Mar 30 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .