quick question re Terminal

Discussion in 'macOS' started by ungar, Jun 24, 2006.

  1. ungar macrumors member

    Joined:
    Feb 11, 2006
    Location:
    Paris
    #1
    Is there a command in Terminal to logoff other users?
     
  2. superbovine macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #2
    I assume you mean logout users from the shell.

    Code:
    cow@supercow cow $ps -u cow
    USER   PID %CPU %MEM      VSZ    RSS  TT  STAT STARTED      TIME COMMAND
    cow    895   0.1  0.1    27804    840  p2  S    11:34AM   0:00.02 -bash
    cow    883   0.0  0.1    27804    852  p1  S+   11:31AM   0:00.06 -bash
    cow@supercow cow $kill -9 883
    cow@supercow cow $
    
    
    that killed the second instance of my shell basically logging me out.
     
  3. ungar thread starter macrumors member

    Joined:
    Feb 11, 2006
    Location:
    Paris
    #3
    Sorry; I'm pretty illiterate when it comes to Unix -- indeed, I don't know what "shell" means. Quite simply, I wanted to change certain permissions regarding my daughter's account, but, since she was logged in, I first had to switch to her account and log her out, then switch back to mine. So my question is: is there something I could have typed in Terminal after the prompt to log her out? Assume her account is called "daughter": what should I type?
     
  4. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #4
    Try:

    shutdown -k now

    It may need to instead be:

    sudo shutdown -k now

    But I'm not 100% sure this won't also log you out.

    The -k means "kick everybody off." sudo means to execute the command with superuser (~ root) privileges. So if you need the sudo part, you will also be asked to give your password. And you will not be able to do it using sudo unless you are using an admin account (but you are so that's ok), because non-admins are not allowed to use sudo.
     
  5. ungar thread starter macrumors member

    Joined:
    Feb 11, 2006
    Location:
    Paris
    #5
    So I can't just kick one user off; it has to be all users?
     
  6. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #6
    You can, but I'm not sure if you can in a nice way. The way described by the previous poster basically involves finding the login process of the user in question and killing it. It's like a house of cards. When you pull the card at the bottom out, the house falls down and the user gets logged out. But that's not a "nice" way, in that it may or may not allow programs to shut down smoothly....

    I think there is probably a "nice" way, but I'm not 100% sure. I think in the Unix tradition, people do it the not-nice way.

    This is very technical but might also help....

    http://forums.macosxhints.com/showthread.php?t=23830
     

Share This Page