Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to log out another user from their session on macOS?

In other words:

  1. Log on as Bert (who is an administrator)
  2. Using fast user switching, log on as Ernie (Bert remains logged on)
  3. Switch back to Bert
  4. Bert logs Ernie off

What is the best way to achieve step 4?

like image 980
Babak Avatar asked Sep 17 '08 01:09

Babak


People also ask

How do I logout of other Users on my Mac?

At any time, you can log out of your user account on your Mac. On your Mac, choose Apple menu > Log Out. If you don't want app windows that are open to reopen when you log back in, deselect “Reopen windows when logging back in.”

How do I force my Mac to logout?

There's also the shortcut Command + Shift + Option + Q to log out without confirmation, but it doesn't help when you have unsaved documents pre-10.7; it just avoids needing to hit Command + Q repeatedly.


1 Answers

sudo launchctl bootout user/$(id -u <username>)

Replace <username> with the target user's user name.

like image 58
Babak Avatar answered Oct 06 '22 08:10

Babak