I have a personal Debian server set up, that I'm able to access in person and remotely, but normally I'm away from it and it's remote. It's on a battery-backup surge protector, but sometimes that isn't enough to keep the server on through a power outage. The machine automatically starts and boots, but its left at the login screen (in person). What I want to know is, what is the best way to have the server get itself back on and online after it loses power, without leaving it vulnerable in person? I'd like it to not auto-login for the screen in person, so that the machine isn't overly vulnerable in-person while I'm away.

Are there battery backups that signal for hibernation or other safe power down automatically? How can I have a user sign in automatically in the background? What would you recommend as a "best practice" for this, considering it's just a home server?

1 Answer 1


Make sure your BIOS is set to restart the system after a power failure.

Turn off auto login unless you have a really good reason for it to be enabled. You shouldn't really need to be interactively logged on for any server type programs to function. Especially if you can get into the system remotely there is no reason for it.

For most any program you need running in the background you can either make an initscript (if there isn't one already) or start it from rc.local without needing to be logged in.

For example, I have apache running on my home server. It launches and runs in the background when I boot. I don't have to explicity start it when my server comes up.

Most battery backups over $50 have a serial port or other mechanism for communicating with a PC. If yours is an APC (a really common brand), you want a package called apcupsd. This lets you call scripts when the power goes out, comes back on, and the system is about to shut down because of low battery. Most battery backups support Linux, it's just a matter of going on the manufacturer's website or doing a bit of Googling.

Generally power events are delivered to init and then init calls the respective programs. Look at /etc/inittab and the comments illustrate this.

You can actually disable console login entirely if you really want to by removing all the "getty" lines in inittab. Don't recommend you do that though, because if your network fails or you misconfigure sshd one day you are screwed.

  • 1
    I've used a package called apcupsd for shutting down a machine when it switched to battery on power failure. I've not heard of apcaccess. Commented May 24, 2011 at 19:47
  • Oh yeah, that's the name of the package. apcaccess is the name of the command line utility that is part of it which outputs its current status. My mistake. I'll edit to correct.
    – LawrenceC
    Commented May 24, 2011 at 20:03
  • Just one question: without the auto-login, do I have to remotely access the machine to restart the server? I'm not totally clear on it. Commented May 25, 2011 at 2:42
  • 1
    With no auto-login the system will boot to a login prompt. You then login and do whatever you want.
    – LawrenceC
    Commented May 25, 2011 at 2:45
  • Is there a way that I could have the user auto-logged in, in the background (as if I had ssh'ed in and logged in), so that all of the processes that I would do when I logged in will be automatic? Commented May 26, 2011 at 13:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .