d@v3

Q: Logout script at login

Hi, can anybody help me with an logout script under 10.7.3 client

 

When I startup and login with an local standard user account I imediatley need to logoff and go back to the loginscreen.....we need this in case of using Filevault2 and AD Networkaccounts?

 

Kind regards

 

Dave

Mac OS X (10.7.3)

Posted on May 10, 2012 7:17 AM

Close

Q: Logout script at login

  • All replies
  • Helpful answers

  • by Topher Kessler,

    Topher Kessler Topher Kessler May 10, 2012 7:18 AM in response to d@v3
    Level 6 (9,866 points)
    May 10, 2012 7:18 AM in response to d@v3

    Are you asking how to make the system immediately log out once logged in to a specific account, or are you experiencing this problem and wish to make it stop?

  • by d@v3,

    d@v3 d@v3 May 10, 2012 7:30 AM in response to Topher Kessler
    Level 1 (0 points)
    May 10, 2012 7:30 AM in response to Topher Kessler

    Yes.....when i'am logged in to specific local useraccount in need to logoff immediately so i get the loginscreen with the login window as: Name and password' field so my AD users can login with their networkaccount.

     

    I'am not into the apple scripting so need some help and think its no problem for the Apple specialist on this discussionform!

     

    Thanks in advance!

     

    Dave

  • by softwater,

    softwater softwater May 10, 2012 7:32 AM in response to d@v3
    Level 5 (5,392 points)
    Mac OS X
    May 10, 2012 7:32 AM in response to d@v3

    In other words you just want to log in order to unencrypt the disk, is that right?

     

    Good security move! I'm not sure I know how to do that off the top of my head, but I'll figure it out it if no one else comes along because such a script would be a very useful piece of work.

  • by Topher Kessler,

    Topher Kessler Topher Kessler May 10, 2012 7:41 AM in response to d@v3
    Level 6 (9,866 points)
    May 10, 2012 7:41 AM in response to d@v3

    The terminal command to use would be the following:

     

    osascript -e 'tell application \"System Events\" to log out'

     

    The AppleScript line to use would be this:

     

    tell application "System Events" to log out

     

    These can be put into a login hook script (http://support.apple.com/kb/HT2420) or can be put into an AppleScript application (which can be created with the Automator utility), which then can be placed in the user's login items so it runs at login.

     

    The problem here is overcoming Apple's warning about automatically resuming your workflow, which appears at every logout.

  • by d@v3,

    d@v3 d@v3 May 10, 2012 7:41 AM in response to softwater
    Level 1 (0 points)
    May 10, 2012 7:41 AM in response to softwater

    Yes....our company wants to use Filevault2 but the pre-boot loginscreen form the Recovery Partition has only the possibilty to a list of users at the loginscreen....So next to the localadmin that's enabled for Filevault i want a second "standard" user with parantel controle and simple finder....when this user is loggin in I want the script to run the logoff action an then we have the normal login screen with name and password field so AD users can login.

     

    Thanks in advance!

     

    Dave

  • by softwater,

    softwater softwater May 10, 2012 7:44 AM in response to d@v3
    Level 5 (5,392 points)
    Mac OS X
    May 10, 2012 7:44 AM in response to d@v3

    I haven't tested it, but this looks like it should do the trick if you write it as a Bash shell script and put it in your 'Login Items'. See if you can set that 'sleep' variable to 0 to get it to log out instantly.

     

    http://superuser.com/questions/40061/what-is-the-mac-os-x-terminal-command-to-lo g-out-the-current-user