Close another user's session

My daughters often leave their sessions open.
Can I close their sessions from the terminal ? (even if it means closing all their open applications without saving)

Posted on Nov 3, 2005 2:55 PM

Reply
16 replies

Nov 4, 2005 12:10 PM in response to Nicolas Silvestre

http://docs.info.apple.com/article.html?artnum=301394

says:

"In Mac OS X 10.3 and later and Mac OS X Server 10.3 and later, you can have your computer automatically log out of your account if you've been inactive for a set amount of time. In the client version of Mac OS X 10.3 and later, you can turn on this feature in the Security pane in System Preferences. In Mac OS X Server 10.3 and later, you can set this option in Login Preferences (click the Auto Log-Out tab).

However, if you have a document open with unsaved changes, the application will cancel the logout process. This is expected behavior. Mac OS X 10.3 and 10.4 do this to prevent you from losing your unsaved data. "

given that, you'd also have to know how to use the kill command to stop another users process, which can be done through Activity Monitor.

The option referenced will set logout delay for all accounts on the computer.

Nov 3, 2005 4:11 PM in response to AJ

Alternately, if you have fast user switching, you can just leave them logged in and switch to a different user.

I'm kinda unclear about the original question: if you have physical access to the computer and someone is logged in, you can just log that person out without needing any special privs. So we must be talking about some kind of remote or multiuser situation?

Nov 23, 2005 8:34 PM in response to Nicolas Silvestre

Hello!

I downloaded software called HyperResearch 2.6 for OX 10.4,
but when I create a non admin account - ie - managed student account,
this software says, "You do not have permission to open the application".
I allowed the student account to run this software but it still does not
open. Noticed on the allowed software list, it un-ticks itself.

I suspect this software is not multi-user aware.
What string or code does the company have to put in for it to work?

This is the software,

http://www.researchware.com/hr/downloads.html

Any thanks if anyone can help!

Sidney
University of NSW
Faculty of Arts
Australia

Nov 28, 2005 8:34 AM in response to sidney06

Welcome to Apple's Discussion Forum system sidney!

If you post a reply to a message in an existing topic, everyone assumes it relates to the subject of the existing topic. That means people who might know about your issue but not the one that started the topic to which you posted won't bother reading your message:( If you want to discuss something new, please always start a new topic.

Nov 28, 2005 9:06 AM in response to Nicolas Silvestre

You can fast user switch from the command line using this shell script:

#!/bin/zsh -f
if [[ $OSTYPE[7] -lt 7 ]];then
print "Fast User Switching is not available in OSX version $os_version"
return 1
fi
if [[ -z $1 ]]; then
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
else
USERID=`id -u $1`;
if [[ -z $USERID ]]; then
return -1;
fi
/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -switchToUserID $USERID
fi

Nov 29, 2005 12:41 AM in response to Finlay

hello,

instead of closing a session, i'd like to log someone in through the terminal (from a remote machine)

i hope you can help me out of this 🙂

thx,

julien


sudo killall -u user
loginwindow



Where user is the username of the account you want to
kill.

Note that this is fairly unclean and won't give apps
a chance to clean up after themselves, but it should
work.

Nov 29, 2005 6:33 PM in response to Bill Scott

Hi Bill,
That's really cool! What I think would be almost as cool is to know how in the world you found out that CGSession accepts those command line options, or any command line option for that matter! I'd be tempted to write a command that finds every executable and tries to invoke it with a --help option. However, CGSession doesn't seem to have help text.
--
Gary
~~~~
I'm not tense, just terribly, terribly alert!

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.

Close another user's session

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