Archive for December, 2007

Linux audit files to see who made changes to a file

This is one of the key questions many new sys admin ask:
How do I audit file events such as read / write etc? How can I use audit to see who changed a file in Linux?
The answer is to use 2.6 kernel’s audit system. Modern Linux kernel (2.6.x) comes with auditd daemon. It’s responsible for [...]

Some syslog Examples

Many other texts written here contain small examples of using the syslog facility within scripts and programs. Three very simple examples of using syslog in C, Perl and a shell script are shown in this text.

DOS2UNIX – Perl and its Wonderful Tricks

The three main computer operating systems in use today have (unfortunately) diverged long ago in their treatment of line-endings. In most documents, the author of the document has certain control over how the information they have authored is being presented. Of major importance is the notion of [...]

Restricted Shell Environments

Sometimes a sandboxed environment is overkill for your needs. If you want to set up a restricted environment for a group of users that only allows them to run a few particular commands, you’ll have to duplicate all of the libraries and binaries for those commands for each user. This is where restricted shells come [...]

SSHD to only accept public-key auth!

If you need to configure the ssh daemon to only accept public-key auth, not password-auth.
edit /etc/ssh/sshd_config
and change following
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords no
RSAAuthentication yes
PubkeyAuthentication yes
UsePAM no
and reload sshd
Thats it!

Iptables help your web server from DDOS!

Distributed Denial of Service (DDoS) is an attack which will consume your bandwidth and makes your web server cannot be reached by users. You can add a iptables (the default firewall in Linux) rule to prevent from being attacked by the DDoS.