Take the 2-minute tour ×

i have setup my ubuntu 12.04 LTS (unity) to auto login after the computer is turned on after a power outage. so that the web server installed keeps running. but also i have to lock the computer right after logging in so that no one can use it other than me. How would i do that.

gnome-screensaver-command -l does lock the computer. but manaully. i want it automated after login.

I dont want anyone to be using the computer other than me.

share|improve this question
The better option is to set your webserver to run at boot, regardless of whether anyone is logged in or not... –  izx Jul 18 '12 at 18:38
@izx if its apache or nginx or lighttpd or one of the ones in the repo (except Node.js and maybe a few other backends), it should auto start at boot. See my answer. –  Thomas W. Jul 18 '12 at 18:45
@LordofTime: I imagined so, but wasn't sure if he was running something esoteric... :) Thanks, upvoted. –  izx Jul 18 '12 at 18:47
add comment

1 Answer

When you install a web server, you don't need to "login" to run that web server.

Web servers such as apache or nginx start up at boot time with their parent process run by root (to bind to ports). Subsequent child processes are generally started with the user or group specified in the configs. Therefore, your computer can be on but not logged in, and your system will still run the web server. Remote administration can be done by SSH whether you're logged in via the GUI or not.

Therefore, there is no need for autologin to make the webserver work (unless its a weird Node.js or some other backend that needs to be manually started by a user).

share|improve this answer
thanks i did not know that. but anyway i would want it to lockup after auto login. i have managed it by inserting gnome-screensaver-command -l command in startup applications. it works till now. is it the right way. or is thr any better one –  Saad Masood Jul 18 '12 at 18:54
That way you have there is a method, but you may want to just consider disabling autologin, given that web servers will normally just load at boot, thereby not needing autologin –  Thomas W. Jul 18 '12 at 19:51
add comment

Your Answer


