Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

3 Answers

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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