Archive for the tag 'linux'

Add or delete static routes from the Linux IP routing table.

You need to know the network/subnet you wish to reach, also the interface you wish this route to be added to, i.e., which interface to use to reach the subnet.

How to reach another network, 10.20.30.0/24, that is reachable via a router on the 192.168.1.0/24 network, 192.168.1.254.

The following ip route command would add the desired route to the kernel routing table:

ip route add 10.20.30.0/24 via 192.168.1.254 dev eth1

Note: eth1 is connected to 192.168.1.0/24

SBDavid

Some common Linux kernel processes

Some common Linux kernel processes

kjournald Commits ext3 journal updates to disk
kswapd Swaps processes when physical memory is low
kreclaimd Reclaims memory pages that haven’t been used recently
ksoftirqd Handles multiple layers of soft interrupts
khubd Configures USB devices

There is one kjournald for each mounted ext3 filesystem.

Among these processes, only init is really a full-fledged user process. The others are actually portions of the kernel that have been dressed up to look like processes for scheduling or architectural reasons.

fsck - check and repair a Linux file system

fsck - check and repair a Linux file system

fsck is used to check and optionally repair one or more Linux file systems. filesys can be a device name (e.g. /dev/hdc1, /dev/sdb2), a mount point (e.g. /, /usr, /home), or an ext2 label or UUID specifier (e.g. UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root). Normally, the fsck program will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of the filesystems.

If no filesystems are specified on the command line, and the -A option is not specified, fsck will default to checking filesystems in /etc/fstab serially.

This is equivalent to the -As options.

The exit code returned by fsck is the sum of the following conditions:

0 - No errors
1 - File system errors corrected
2 - System should be rebooted
4 - File system errors left uncorrected
8 - Operational error
16 - Usage or syntax error
32 - Fsck canceled by user request
128 - Shared library error

The exit code returned when multiple file systems are checked is the bit-wise OR of the exit codes for each file system that is checked.

Email notification everytime users run “sudo” on Linux

For Redhat, Centos Systems make sure that sendmail is running on the machine and configured to send out emails.

Run

visudo

Add the following configuration in /etc/sudoers

visudo parses the sudoers file after the edit and will not save the changes if there is a syntax error.

Defaults mail_always
Defaults mailerpath=/usr/sbin/sendmail
Defaults mailto=”root@serverbuddies.com”
Defaults mailsub=”*** Command run via sudo on %h ***”
Defaults mailerflags=”-t”

How to determine system log settings for a Linux server?

Usually the /var/log/messages file is used for the regular system messages.

It is possible to find which place is used by a Linux system for logging from the /etc/syslog.conf or /etc/rsyslog.conf configuration files:

#cat /etc/syslog.conf

or

#cat /etc/rsyslog.conf

« Prev - Next »