PAM Script to Turn off auto screen-lock in Gnome Shell

Update: I’ve created a new version of this script that can be run by NetworkManager, turning Gnome screensaver auto-lock on or off as the wireless essid changes.

In Linux, we have Pluggable Authentication Modules and various applications use PAM to authenticate users. Marco Ditri posted about using PAM to run a script that would prevent xscreensaver from locking the screen on his laptop when connected to his home wireless network.

I wanted to do the same in Gnome, so I’ve modified Marco’s script to use gsettings to disable Gnome Shell auto screen-lock when authenticated to particular wireless networks and enable it everywhere else. You’ll find comments in the script on how to incorporate it in your local PAM configuration.