Require password ONLY after sleep.

Discussion in 'OS X Mavericks (10.9)' started by arvacker, Nov 17, 2013.

  1. arvacker macrumors member

    Joined:
    Oct 6, 2011
    #1
    Hello,

    i know there are many treads on the web on how to enable/disable password prompt after sleep/screensaver, my question is different.
    I want to require a password prompt, only when the computer wakes from sleep, not after the screen has been turned off (or the screensaver started).
    Situation is the following: Person is working on his MacBook Air connected to Thunderbolt Display, he/she gets a call, computer turns of the screen (but doesn't go to sleep, it keeps the connections live), person ends call and wants to continue to work without having to enter his/her password.
    Person leaves his desk, unplugs the air and drops it in his/her bag (putting it to sleep), person arrives at location, opens up Air and is prompted for his/her password.

    Note: i'm aware i can set a timeout between screensaver/sleep and requiring a password, but I want it to require a password immediately after sleep and never after display turned off (screensaver started).

    Hope you guys can help!

    Greetings,

    Arne
     
  2. satcomer macrumors 603

    satcomer

    Joined:
    Feb 19, 2008
    Location:
    The Finger Lakes Region
    #2
    System Preferences->Security and put a checkmark in the box for 'Require a Password' and move the toggle bar to 'Immediately' after sleep or screensaver begins.
     
  3. dastinger macrumors 6502a

    dastinger

    Joined:
    Mar 18, 2012
    #3
    That does not do what the OP is asking for. Read again ;)
     
  4. throttlemeister, Nov 18, 2013
    Last edited: Nov 18, 2013

    throttlemeister macrumors 6502a

    Joined:
    Mar 31, 2009
    Location:
    Netherlands
    #4
    What you probably want is to use SleepWatcher

    and have issue the command: /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

    EDIT: tested it, and it works like a charm.
     
  5. arvacker thread starter macrumors member

    Joined:
    Oct 6, 2011
    #5
    i'm sorry, i've installed SleepWatcher and issued the command, but that just makes my computer ask for my password.
    How would i have to set it up exactly for my computers to work the way I intend? (turn screen off after 15min, put to standby after 60min and only ask for a password when i wake the computer from standby, so after 60min)
    should I put a command/script somewhere to ask for the password after 60min?
    (I'm quite good with OSX, but i'm fairly new to terminal and scripting)

    Thank you for you help so far, i appreciate it!

    Arne
     
  6. throttlemeister macrumors 6502a

    Joined:
    Mar 31, 2009
    Location:
    Netherlands
    #6
    Then I don't know what you want my friend. When I installed this, my screensaver would not ask for a password, but putting the computer to sleep would present me with the login screen after waking up.

    Did you read the instructions on how to set it up? That command needs to be issued by sleep watcher, not by you. You need to configure sleep watcher to issue that command when your computer goes to sleep.

    Sidenote: you need to configure sleep watcher as a user service; this command only works when it's issued by the user that is logged on, so sleep watcher needs to be running as the user. That's in the second part of the read me.
     
  7. arvacker thread starter macrumors member

    Joined:
    Oct 6, 2011
    #7
    alright, I've configured sleepwatcher, when I use the default rc.sleep and rc.wakeup scripts that come with the program, it works. I just don't know where to enter the command you propose. Is it in the rc.sleep file? if so, then where in this file? I'm terribly sorry to keep bothering you, I have little to no experience with unix scripts/terminal.

    I've tried it like this:

    for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3 }'`; do
    home=`eval echo ~$user`
    if [ -x "$home/.sleep" ]; then
    logger -t $0 "executing .sleep of user $user"
    “excecuting /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend”
    su - $user -c "$home/.sleep"
    fi
    done

    and like this:

    for user in `echo 'show State:/Users/ConsoleUser' | scutil | awk '/kCGSSessionUserNameKey/ { print $3 }'`; do
    home=`eval echo ~$user`
    if [ -x "$home/.sleep" ]; then
    logger -t $0 "executing .sleep of user $user"
    su - $user -c "$home/.sleep"
    /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend
    fi
    done

    (this is in the rc.sleep file)

    thanks again for your help.

    Arne
     
  8. throttlemeister macrumors 6502a

    Joined:
    Mar 31, 2009
    Location:
    Netherlands
  9. Nikecow macrumors newbie

    Joined:
    Mar 10, 2015
    #9
    Yosemite

    I tried this but it does nothing at all.

    Anyone knows a way to do this in Yosemite?
     

Share This Page