3

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.

  • The better option is to set your webserver to run at boot, regardless of whether anyone is logged in or not... – ish 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 Ward Jul 18 '12 at 18:45
  • @LordofTime: I imagined so, but wasn't sure if he was running something esoteric... :) Thanks, upvoted. – ish Jul 18 '12 at 18:47

1 Answers1

1

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).

Thomas Ward
  • 74,764
  • 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 -lcommand 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 Ward Jul 18 '12 at 19:51
  • http://askubuntu.com/questions/539266/how-to-enable-autologin-but-still-require-password/539270#539270 answered here – dedunu Jun 23 '15 at 04:09