Reboot on kernel panic

Anyone who runs Linux servers remotely knows that you can do almost ANYTHING from the CLI. One of the more tricky things to do is install a new kernel. Too often, if there is an error in the new kernel build the machine will kernel panic and lock up.

The only way around that is to manually power cycle the machine – unless you pass a panic parameter to the kernel on boot up.

Just add a line like this to your lilo config

append=”panic=15″

After 15 seconds the machine will reboot. If lilo was run with the -R parameter, the server will come back up with the old kernel.

Restricting crontab

crontab is a scheduling system available on most linux distributions

Sometimes users will create cron jobs that will slow a server down. Access to cron can easily be restricted to all users but the administrator by editing /etc/cron.allow

If, for example, root and only one person (with username user) should be the only ones able to use cron just put root on one line and user on another in /etc/cron.allow.

Note: If cron.allow exists only users in the file will be able to use cron.

Linux Directory Structure

To a Windows user the Linux Directory Structure can seem very foriegn. Here is a quick synopsis of the standard top level Directory Structure on a standard Linux box.

/ : The top level directory in the system. This is often called the root directory, because it is the 'root' of the filesystem, though there is, in fact, a /root directory.

/bin : The home of binaries for your system. The /bin directory is in the PATH environment variable by default, meaning that any executable file in this directory can be executed merely by entering the file name at the command line – provided you have executable permissions.

/boot : Contains files necessary to boot your system. These include the kernel image and system.map.

/dev : The dev directory is the top level of device abstraction in Linux. This is where each device filesystem will be mounted from. Interfaces to your hard drives, cdrom, mouse and sound card are all found here.

/etc : Most configuration files in Linux are contained in the /etc directory. This also houses startup scripts.

/home : The home directories for each system user. A user is placed in /home/ when logging in.

/lib : Default location for Library files shared throughout your system, although libraries can be stored in any directory as long as it is added to /etc/ld.so.conf.

/proc : Another abstraction directory, /proc contains information about the processes on your system.

/root : The home directory of the root user.

/sbin : Contains additional system binaries, most of which are admin tools. You'll need to be logged in as root to run many of these files, although you may be able to run them by explicitly specifying the path (/sbin/ifconfig).

/tmp : The temporary directory.

/usr : The /usr directory contains subdirectories that will be used system-wide by all users. These may include binaries, libraries, man files, and other user resources. This is also a good place to add new applications. When updating the operating system it is much easier to peruse /usr for applications than search the whole filesystem.

/var : Contains the variable data that's always changing as the system runs. This directory contains logs files, mail directories and printing spools.

Configure the linux to write corefiles as core.pid?

If you dump core files you can run into a problem where multiple core files are dumped and one will overwrite the others. One solution to this problem is to change the Linux kernel so it will dump core to a file named core.pid .

Starting in the 2.4.x kernel series this can be accomplished by changing the value of /proc/sys/kernel/core_uses_pid from 0 to 1.