Friday, January 13, 2012

How to lock the screen saver (or any feature) in gnome.

This one was a pretty big pain to find for some reason so I decided to put it here. If you use gconf-editor this is really easy. Just run gconf-editor with root privileges (sudo, or as root) and navigate to the setting you would like to change. For our example, we'll change the gnome-screensaver settings. This was tested in RHEL 5.6, 5.7, and 6.2.

If you don't have gconf-editor, you can install it with yum (yum install gconf-editor).

mybox $ sudo gconf-editor

Then expand apps->gnome-screensaver

Change the appropriate settings and then right click on them. You can select “Set as Mandatory” to lock this setting for all users.

If you have many systems you need to lock down you can use the command line tool called gconftool-2. Below is an example of the command line usage to change the screen saver settings to for screen lock on users after 15 minutes of inactivity.

mybox $ gconftool-2 --direct \

--config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \

--type bool \

--set /apps/gnome-screensaver/idle_activation_enabled true


mybox $ gconftool-2 --direct \

--config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \

--type bool \

--set /apps/gnome-screensaver/lock_enabled true


mybox $ gconftool-2 --direct \

--config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \

--type string \

--set /apps/gnome-screensaver/mode blank-only


mybox $ gconftool-2 --direct \

--config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \

--type int \

--set /apps/gnome-screensaver/idle_delay 15

Wednesday, January 11, 2012

Stop That Banner!

I do a lot of repetitive tasks on many different machines, and I use ssh to get me there. One thing that annoyed me the most was the long banner message taking up most of my console window. The banner is a requirement for us, so I cannot simply remove it on the server side. We use Red Hat Enterprise Linux and Solaris 10, and the following is what I use to stop the banner from displaying:

If you are on Linux or Solaris you first need to have the .hushlogin file in your home directory on the machine that you are ssh'ing into: by running the following command, "touch .hushlogin", you will banner displaying on Solaris, but not on Linux. On Linux, this will stop the "Last login..." message. To stop the banner from displaying in Linux, you need to issue the ssh command with the -q switch, "ssh -q [hostname]".