Auto Login & Lock For Linux & Windows

Overview

I had conceived an idea to automatically login and lock the screen. A Google later and I found that I wasn’t the only one.

An advantage of this set up is it allows you to login and start up all the programs like IM, G15 manager, Email Client, etc and lock the screen so people can’t get into your account.

I also had a problem with MythTV backend service which starts but the front end could never connect to it. However starting it manually using the command mythbackend starts fine and the front end is happy. In the end I added the command as a start up item when I log in. The problem is if Ubuntu restarts and not logged into my account then MythTV is not running and won’t record anything let alone watch / schedule programs.

Linux (Gnome)

Setup Auto Login

Type this command (Alt+F2) in Gnome to bring up the Gnome Login Manager:
gksu /usr/sbin/gdmsetup

GDM Settings

Go to “Security” tab and tick “Enable Automatic Login” and select the user account in the drop down box below it. Click OK to save the settings.

Lock On Login

Run the command:
gnome-session-properties
Or System > Preferences > Sessions from the menu

Startup Item

In “Startup Programs” Tab click “Add” button.
Enter a name and optionally a description. The command is:
gnome-screensaver-command --lock
Click OK to save the start up item.

Windows

I did have a problem with the locking part on the Windows side so I abandoned the idea. The Task Scheduler kept reporting failure to start the task and the lowest value for a retry was 1 minute. In my opinion 1 minute is too long and allows any physically at the computer enough time to disable the locking task. That being said the concept should work but it has baffled me.

The auto login still works for those interested.

Setup Auto Login

Start User Accounts settings:
Start Menu > Run
Enter control userpasswords2 and press O.K

Un-tick “Users must enter a user name and password to use this computer.” and press OK button. It should ask you for a user name and password of the account you want to automatically log into.

Lock On Login

Start Task Scheduler:
Control Panel > Administrative Tools > Task Scheduler

Task Scheduler

Click “Create Task” and enter the program / script as rundll32.exe with the arguments user32.dll,LockWorkStation

The trigger is “At startup” You can optionally add a start up delay. This might be a good idea because it allows the system to login and load some stuff before starting another process to lock the computer. The downside to this method is that it leaves your system vulnerable for few seconds / however long you set it to.

lock screen – command? Ubuntu Forum Post

Auto login MSDN Article

Create quick launch shortcuts to lock, restart, and shutdown computer Article

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux, Security, Windows and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.