Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By mistake I edited the limits.conf file and set the max open files (fd) to 0 for the root user, how can I revert this (can't login in the machine now)... some kind of safe mode or something like that?

centos 5.3

share|improve this question
up vote 10 down vote accepted

Assuming that you have physical access to the machine..

I suspect you won't be able to fix it by booting to single user.

So grab yourself a Linux LiveCD (any distro will do, I prefer Gentoo's).

Boot from it, mount your local CentOS root partition, edit the required file, umount and reboot.

That should be it.

share|improve this answer

An alternative to using a boot CD is to get to the grub boot menu and edit the kernel line to add "init=/bin/sh". With Ubuntu you need to remove "quiet" and "splash" from your kernel line too. Now boot this modified boot option. You should get dumped into a shell. You need to remount your root file system read-write using:

# mount -o remount,rw /

Mount any additional filesystems. Edit your limits.conf and save it. Remount the filesystem read only:

# mount -o remount,ro /

Throw in a "sync" command just to be on the safe side, then reset the computer. Now you should boot normally.

share|improve this answer

You don't need boot CD to edit grub menu. Boot as usual until grub boot menu appears, select grub menu entry, press 'e', edit line that starts with 'kernel... ', press 'enter', press 'b'.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.