Terminal Command to Log Out User

I have Fast User Switching enabled. I would like to log users out that forgot to log out. What are the Terminal commands to log out someone named Alice who is a Standard user in OS X.3.9? I'm getting tired of having to restart to shut down the users account. Will the commands be the same for an Administrators account?

Thanks for your help,



G4 Quicksilver Dual 1 GHz, 1.5 GB RAM, Sonnet ATA133 card, Maxtor ATA133 drives Mac OS X (10.3.9) B+W G3 450 MHz, OS 9.2.2, 1 GB RAM

Posted on Jun 29, 2006 7:36 PM

Reply
6 replies

Jul 1, 2006 2:21 PM in response to Bill Scott

Thanks Bill, but what I am asking is how to completely log out a particular user while I remain logged in. Are there commands I can execute from Terminal to log out a user? I am the Admin.

G4 Quicksilver Dual 1 GHz, 1.5 GB RAM, Sonnet ATA133 card, Maxtor ATA133 drives Mac OS X (10.3.9) B+W G3 450 MHz, OS 9.2.2, 1 GB RAM

Jun 29, 2006 8:33 PM in response to 4paul3

If you're the Admin, then you should be able to use Terminal as root to log someone out like this:

sudo killall -u [username]

This should kill all processes in that user account, and it may log them out also (I can't test this on a single user machine). If it doesn't, you can use:

sudo shutdown now

which will log out everyone and shutdown the system to single-user mode for the root/Admin user.

Hope this helps,

Mulder

If my answer helped solve your problem, please consider awarding some points. Why Reward Points?

iMac G4 700Mhz Mac OS X (10.3.9)

Jun 29, 2006 9:32 PM in response to Mulder

Thanks Mulder,

It didn't log the user out though, and I would rather not go into single-user mode because users still need to be able to log in when needed. I just want to shut them down when I need to. There was some activity but the users Finder, aped, Dock, and SystemUIServer are still running which is pretty good. Any other suggestions?

G4 Quicksilver Dual 1 GHz, 1.5 GB RAM, Sonnet ATA133 card, Maxtor ATA133 drives Mac OS X (10.3.9) B+W G3 450 MHz, OS 9.2.2, 1 GB RAM

Jun 30, 2006 7:08 AM in response to 4paul3

As I'm not a Unix expert, the only other suggestion I can offer is to use killall to kill those remaining processes for that user; i.e.:

sudo killall -u [username] -c [processname] (Finder, aped, etc.)

However, killall should have killed all processes and not left any running, which would effectively logut that person.

Mulder

Jul 1, 2006 2:11 PM in response to 4paul3

The terminal commands for fast user switching are these:

1. To get the login screen:

<pre>
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
</pre>

2. To switch to a particular user:

<pre>
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID Phred
</pre>

where, in this example, you want to switch to the user Phred

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Terminal Command to Log Out User

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.