The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   Applications (http://hintsforums.macworld.com/forumdisplay.php?f=5)
-   -   Make Screensaver require a password, when specified... (http://hintsforums.macworld.com/showthread.php?t=14085)

pyrohotdog 08-07-2003 11:28 PM

Make Screensaver require a password, when specified...
 
I'm constantly coming and going to and from my computer, and so the screensaver frequently comes on and off. I used to have it set to require a password, so I could protect my stuff, but with the coming and going, it got a bit tiring entering a password each time, so I turned require a password off. But sometimes I leave it for short periods of time, and it's fine to have it off, but other times, I leave and I want it on! I don't want to keep going to System Prefs to change it, is there a way to have it come on only when specified? E.g., Hotkey F1 turns on Screensaver without password required, F2 turns on with password required? Or even cooler, one screen corner and another?

DeltaMac 08-07-2003 11:36 PM

Here's what I do, perhaps it will be OK for you, I don't use a password on the screensaver, so I hit the corner when I step away. If I leave the building, don't know how long, I just log out, so a password will be needed then to log back in.

chabig 08-08-2003 12:26 AM

I have the screensaver set to require a password. I have one corner set to inhibit the screensaver. If I don't want to enter a password, I put the cursor in that corner. Otherwise the screensaver starts and I have to use the password.

Chris

macmath 08-08-2003 12:38 AM

If you open Keychain Access, under the View menu is "Show status in menu bar"

Select this. In the menu bar will appear a lock. Under that lock is the option to "Lock Screen". Just select this when you leave.

mclbruce 08-08-2003 01:03 AM

Quote:

Originally posted by macmath
If you open Keychain Access, under the View menu is "Show status in menu bar"

Select this. In the menu bar will appear a lock. Under that lock is the option to "Lock Screen". Just select this when you leave.
Very cool hint MacMath! I had no idea this was there. I'm not sure if it will solve the problem for flaming ween-, er, pyrohotdog, but I like the hint.

It would be interesting to come up with something that would turn on the screensaver after 5 minutes and engage password protection after, say 15 minutes.

macmath 08-08-2003 06:10 PM

Thank you. It is enjoyable to be able to contribute something now and then.

Quote:

Originally posted by macmath
If you open Keychain Access, under the View menu is "Show status in menu bar"
Select this. In the menu bar will appear a lock.
I neglected to mention, for those who aren't familiar with settings which create an item in the menubar, that one only has to do the above once. Once you select "Show status in menu bar.", the lock will be a permanent citizen of the menubar through shutdowns and restarts until you deselect this same option. Thus, any time you leave your desktop, all you have to do is select "Lock Screen" from this menu item.

I'm guessing that someone more knowledgeable than myself knows or can write a shell script to lock the screen (or to invoke "Lock Screen" without using the menubar item). This script could then be invoked by a function key or a key sequence using existing software.

djn1 08-08-2003 07:00 PM

FWIW, the setting for whether the screensaver requests a password or not is in:

~/Library/Preferences/ByHost/com.apple.screensaver.xxxxxxxxxxxx.plist

... of the format:

<key>askForPassword</key>
<integer>1</integer>

Where 1 is 'password required' and 0 is not.

macmath 08-09-2003 10:50 AM

Thanks, djn1.

The terminal commands
defaults write byhost/com.apple.screensaver.xxxxxxxxxxxx askForPassword "0"

defaults write byhost/com.apple.screensaver.xxxxxxxxxxxx askForPassword "1"[/CODE]
turn the request for password off and on, respectively (where the xxxxxxxxxxxx is as in the screensaver file in the directory ~/Preferences/byhost/)

If one makes a clickable shell command with
Code:

#! /bin/tcsh
defaults write byhost/com.apple.screensaver.xxxxxxxxxxxx askForPassword "0"

and
Code:

#! /bin/tcsh
defaults write byhost/com.apple.screensaver.xxxxxxxxxxxx askForPassword "1"

Then you could (1) use any of a number of applications to assign a key sequence to select one or the other as necessary; (2) put them in ~/library/preferences/scripts/ if you use the Script.menu; (3) put them in a ~/Dock folder and then drag the ~/Dock folder to the Dock.

Others will likely have a more elegant way to do this.

[Edited to say that if the xxxxxxxxxxxx changes occasionally, then I don't know what to do.]

djn1 08-09-2003 11:46 AM

Do you not have to prefix 'byhost/com.apple.screensaver.xxxxxxxxxxxx' with '~/library/prefences/'; i.e. specify the full path?

mervTormel 08-09-2003 12:41 PM

seems that this may be the preferred method of manipulating the screensaver defaults:
Code:

$ defaults -currentHost read com.apple.screensaver
{
    askForPassword = 1;
    hotCorners = ((1, 1, 1, "-1"));
    idleTime = 600;
    moduleName = "Black Light Screen Saver";
    modulePath = "/Users/test/Library/Screen Savers/Black Light Screen Saver.saver";
    previousModuleName = "Black Light Screen Saver";
}

$ defaults -currentHost write com.apple.screensaver askForPassword 0

$ defaults -currentHost read com.apple.screensaver
{
    askForPassword = 0;
    hotCorners = ((1, 1, 1, "-1"));
    idleTime = 600;
    moduleName = "Black Light Screen Saver";
    modulePath = "/Users/test/Library/Screen Savers/Black Light Screen Saver.saver";
    previousModuleName = "Black Light Screen Saver";
}

--

$ defaults -currentHost read com.apple.screensaver askForPassword
0

$ defaults -currentHost write com.apple.screensaver askForPassword 1

$ defaults -currentHost read com.apple.screensaver askForPassword
1

so, now one can craft a script to toggle the askForPassword value.

macmath 08-09-2003 12:58 PM

Quote:

Originally posted by djn1
Do you not have to prefix 'byhost/com.apple.screensaver.xxxxxxxxxxxx' with '~/library/prefences/'; i.e. specify the full path?
No. When I did specify the full path, the document com.apple.screensaver.xxxxxxxxxxxx was not readable thereafter. It worked approriately when I used only 'byhost/com.apple.screensaver.xxxxxxxxxxx' I tried this because when writing defaults in other cases, the path to the Preferences folder is unneeded.

I see that mervTormel has given the appropriate method, however. I've verified that what he has written works for me.

macmath 08-09-2003 01:43 PM

Not that I doubted that what mervTormel wrote would work!

...but anytime I see a generic term like -currentHost, I think that it might be a variable which I need to replace with something referring to me (like a shortname); thus, I had to try it out to see that it works just as it is written.

mervTormel 08-09-2003 03:08 PM

had to wrangle a bit with the defaults manpage to discover this -currentHost switch refers to this ByHost/ dir

i think

djn1 08-09-2003 03:10 PM

Quote:

Originally posted by mervTormel
had to wrangle a bit with the defaults manpage to discover this -currentHost switch refers to this ByHost/ dir
... works here ok too so I suspect you got it right.

simX 08-09-2003 06:32 PM

Uh, why are you guys going through all that trouble to make those scripts when the mentioned hint with the Keychain Access program works perfectly? Even if you have asking for a password off in system prefs, the Keychain menu extra allows you to lock the screen when you specifically set that menu item, but it still doesn't change the system preferences.

Isn't that what was wanted? (You could probably use MenuMaster to even assign a hotkey to it, if you don't mind using Application Enhancer.)

djn1 08-09-2003 06:37 PM

Quote:

Originally posted by simX
Uh, why are you guys going through all that trouble to make those scripts when the mentioned hint with the Keychain Access program works perfectly?
Fun? :D

mervTormel 08-09-2003 10:12 PM

Quote:

Originally posted by simX
Uh, why are you guys going through all that trouble to make those scripts when the mentioned hint with the Keychain Access program works perfectly?...
it's interesting and i discovered some more krufty things about the defaults facility and i don't like using the mouse :D

alternapop 02-18-2005 04:11 PM

Quote:

Originally Posted by simX
Uh, why are you guys going through all that trouble to make those scripts when the mentioned hint with the Keychain Access program works perfectly? Even if you have asking for a password off in system prefs, the Keychain menu extra allows you to lock the screen when you specifically set that menu item, but it still doesn't change the system preferences.

Isn't that what was wanted? (You could probably use MenuMaster to even assign a hotkey to it, if you don't mind using Application Enhancer.)


because you can make this change on many machines at the same time as an admin using ARD2. not everyone wants a solution that using the GUI and applies to the machine you're sitting at.

phillymjs 09-26-2006 12:11 PM

I have tried this:

defaults -currentHost write com.apple.screensaver askForPassword 1

on two machines running 10.4.7, one Intel MacBook and one Powerbook G4. It doesn't work. The change is made to the preference file, but the computers ignore it, and the change is also not reflected in the appropriate checkbox in the Desktop and Screen Saver preference pane.

I tested logging out and back in after changing the preference, and also rebooting, and it just doesn't matter. Unless I un/check the checkbox in the actual GUI, no changes I make to that setting take effect.

Anyone else seeing this behavior? I need to apply this setting to a large number of managed Macs, and it's gonna SUCK if I have to go around to every machine and do it manually.

edit: I just realized that the askForPassword key value is a string, so the correct command should be:

defaults -currentHost write com.apple.screensaver askForPassword "1"

but that doesn't work, either!


~Philly

alternapop 09-26-2006 12:15 PM

i bet apple doesn't support this functionality either. they will only support it not working if you change it via the GUI and it fails there. that sucks!

DeltaMac 09-26-2006 11:23 PM

Dredging up an old thread might be counter-productive...
There's been two major updates to OS X since this thread was active 3 years ago. Is it possible that the hint described here has been superceded? (and even takes you in completely the wrong direction).

phillymjs 03-10-2007 01:28 PM

Revisiting this old post...
 
I was just going through some old notes and cruft that have collected in my home folder, and found the link to this thread.

Just wanted to mention that it appears that there was a bug in 10.4.7 that has been fixed in 10.4.8-- setting the 'require password' flag in Terminal now works. The change is immediately reflected in the GUI as well.

I cannot figure out which service to bounce to get it to take effect immediately, though-- right now the change only takes effect after the user logs out and logs back in (and presumably after a reboot as well).

Anyone have any ideas how to force the change to take effect immediately?

altf4 07-03-2010 12:32 PM

if so, the bug is still there ;)

i just try this based on another thread result on 10.6.4 .. same effect as described 3 years ago ;)

phillymjs: you have figured something on this ? since its a 7 Years old Thread .. it seems a unsolvabe issue :(


All times are GMT -5. The time now is 03:23 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.