| OS X - Operating System General OS operation information and support |
| Post Reply | New Thread | Subscribe |
|
|
Thread Tools |
![]() Member Since: Aug 10, 2010
Posts: 13
![]() |
I'm looking for a way to log out a background user who forgot to log out - from the terminal.
I know this is trivial in the *nix world, just killing a process probably; I just can't find the command to do it in Mac's flavor (I'm a casual *nix shell user) BTW, I don't want the Prefs->Security->General "logout after inactivity" setting.... that logs out everybody (including me) and I can't have my account logged out (due to running processes). this is the closest I have gotten so far: but this will obviously log me out. osascript -e 'tell application "System Events" to log out' Thank you, Jason Last edited by asiajason; 11-18-2011 at 02:10 AM. |
| QUOTE Thanks | |
![]() Member Since: Sep 30, 2007
Location: Wilmington, NC
Posts: 5,787
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: iMac i3 (mid-2010) + OS 10.8; TV 2; iPhone 4S; iPad 1
|
I'm having a tough time finding a way to do this with Terminal. A couple tricks I read of and tried that involved killing the "loginwindow" process for another user didn't work as expected. At the moment, here's the best solution I can find but involves a 3rd party utility:
How to log out a fast switched user |
| QUOTE Thanks | |
![]() Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,302
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2012 13" MBP (2.5 i5, 8GB)
|
Remember, OS X is Unix so if there's some technique that you know of in Unix, it may work here. Now, the variants of Unix are all quite different so I can't guarantee this is the case here. What do you do on a *nix box to accomplish this?
Important Links: Community Guidelines : Use the reputation system if you've been helped. M-F Blog :: Write for the blog :: M-F IRC Channel - Chats every Sunday at 8PM EST. |
| QUOTE Thanks | |
![]() Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,527
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff
|
Quote:
kill -9 `ps -u <username> | grep -v PID | awk '{ printf ("%s ", $1); }'` would accomplish this it's ummm well, kinda forceful though
mike This machine kills fascists Got # ? phear the command line! |
|
| QUOTE Thanks | ||
![]() Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,302
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2012 13" MBP (2.5 i5, 8GB)
|
Code:
echo "ARE YOU SURE!?!?!? PRESS ENTER IF YOU'RE SURE!" ; read
kill -9 `ps -u <username> | grep -v PID | awk '{ printf ("%s ", $1); }'`
Important Links: Community Guidelines : Use the reputation system if you've been helped. M-F Blog :: Write for the blog :: M-F IRC Channel - Chats every Sunday at 8PM EST. |
| QUOTE Thanks | |
![]() Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,527
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff
|
mike This machine kills fascists Got # ? phear the command line! |
| QUOTE Thanks | |
![]() Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,302
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2012 13" MBP (2.5 i5, 8GB)
|
Important Links: Community Guidelines : Use the reputation system if you've been helped. M-F Blog :: Write for the blog :: M-F IRC Channel - Chats every Sunday at 8PM EST. |
| QUOTE Thanks | |
![]() Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,527
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff
|
mike This machine kills fascists Got # ? phear the command line! |
| QUOTE Thanks | |
![]() Member Since: Aug 10, 2010
Posts: 13
![]() |
Quote:
However, when I try this, the <username> is an invalid argument of "ps". Should this be user ID? When I do $ps -u, I only see my username. $ps -A lists a lot of processes, but I don't see any from the other users in the background.... Can you help correct this? |
|
| QUOTE Thanks | ||
![]() Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,527
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff
|
Umm yea, it should be a valid username, without the <>'s
Oh and you'd need to issue that with either root or superuser authority. mike This machine kills fascists Got # ? phear the command line! |
| QUOTE Thanks | |
![]() Member Since: Aug 10, 2010
Posts: 13
![]() |
Quote:
The user still shows up in the FSU list however, and switching to that user hangs the GUI/console - so it's definitely not clean! But it is an option, and I thank you! Thanks greatly! |
|
| QUOTE Thanks | ||
![]() Member Since: Mar 17, 2008
Location: Tucson, AZ
Posts: 6,527
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2008 and 2011 15" mbps, late 11 iMac, iPhone 4s, and too many ipods and other stuff
|
Ohhh ok, gotcha. But I think it's the opposite, that username is lowercase and UID is upper.
Yea, it's not the cleanest method in the world. It's a bit like hitting a nail with a sledgehammer
mike This machine kills fascists Got # ? phear the command line! |
| QUOTE Thanks | |
| Post Reply | New Thread | Subscribe |
| Thread Tools | |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|
|||||||
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Nearly half of small business users accessing work email use iPhone | the8thark | Apple Rumors and Reports | 0 | 02-11-2011 07:42 PM |
| Setting 32bit for multiple users using CS5 | SCC2010 | OS X - Apps and Games | 0 | 11-03-2010 12:34 PM |
| The latest "Get a Mac "ads | Kilted1 | Schweb's Lounge | 34 | 05-17-2008 06:39 PM |
| Sky by Broadband not available to Mac users: please complain | TimandJane06 | Schweb's Lounge | 1 | 07-09-2006 09:56 AM |
| Mac Users Get More ISP Choices | schweb | Apple Rumors and Reports | 1 | 03-06-2003 10:57 AM |
All times are GMT -4. The time now is 07:26 AM.
Powered by vBulletin