Locking screen without admin password

Hi all, bit desperate here. We want to use something similar to the locked screen with screensaver, but we don’t want our users to know the admin password. Is there a way of doing this using a basic password?

Hello.

I can make the screen lock without a password, or let the screen go black, but letting the user have to log back in afterwards.

I believe that the user can just press cntrl-shft-eject to lock the screen, but will then have to Enter a password to open it.

The script below disables the need for submitting a password. That is the best I can do, as I can’t install anything on a “key pressed” event.


tell application "System Preferences"
	tell anchor "General" of pane "com.apple.preference.security" to reveal
	activate
end tell
tell application id "sevs"
	set a to value of checkbox 2 of tab group of window 1 of application process "System Preferences" as integer
	if a = 1 then
		tell checkbox 2 of tab group of window 1 of application process "System Preferences" to click
	end if
end tell
tell application "System Preferences" to quit
-- do shell script "/System/Library/CoreServices/Menu\\ Extras/user.menu/Contents/Resources/CGSession -suspend"
-- Alternatively have the user log back in with their user password by the line above. Instead of what follows.
tell application id "sevs"
	set ss to screen saver "Arabesque"
	start ss
end tell

This snippet turns on the need for supplying a password to awake the screen again.


tell application "System Preferences"
	tell anchor "General" of pane "com.apple.preference.security" to reveal
	activate
end tell
tell application id "sevs"
	set a to value of checkbox 2 of tab group of window 1 of application process "System Preferences" as integer
	if a = 0 then
		tell checkbox 2 of tab group of window 1 of application process "System Preferences" to click
	end if
end tell
tell application "System Preferences" to quit

Edit

There is probably a better way to lock the screen with keychain access, but I can’t figure out what the parameter would be.