Scripting

Script to customize a linux install

This is a simple bash script I whipped together to make som custom changes on our linux installations, it can be used as a kickstart post-configuration file for RedHat RHEL4 and RHEL5 installations. #!/bin/bash # Enable daily updates of the locate database perl -pi -e ‘s/DAILY_UPDATE=no/DAILY_UPDATE=yes/’ /etc/updatedb.conf # Customize login banners echo “Authorized users only. […]

Read More
Network

Use local DNS name and IP from DHCP

For Red Hat Linux if you receive your IP address from a DHCP server, you may update the local DNS name by adding the following line to the correct ifcfg file in /etc/sysconfig/network-scripts, such as ifcfg-eth0 or ifcfg-eth1: DHCP_HOSTNAME=”myhostname.example.com” If you are running Debian, edit /etc/network/interfaces as follows (adding the hostname line) iface eth0 inet […]

Read More
Security

Allow NFS through iptables on a RedHat system

This post describes how you can configure your RedHat Enterprise WS 4 NFS system behind a iptables firewall to be available for clients outside the firewall on a permanent basis. Symptom NFS relies on portmap to assign the ports on which it will listen. One side effect of this is that the ports are randomly […]

Read More
Linux

Rotate logs manually

Today I had to manually rotate a couple of logs since they had generated a filesize of over 1.8GB of pure text. This was done by issuing the command logrotate /etc/logrotate.d/file_to_be_rotated In my case I had to rotate my firewall log /var/log/firewall described in a custom made file, /etc/logrotate.d/firewall logrotate -v -f /etc/logrotate.d/firewall -v Verbose […]

Read More
Linux

Query RPM database/packages and list their architecture

If you use the –queryformat argument with rpm it is possible to query RPMs for different architectures installed# rpm -qa –queryformat %{NAME}-%{VERSION}-%{ARCH}\\n | grep dbus-glib | sortResultdbus-glib-0.22-12.EL.5-i386dbus-glib-0.22-12.EL.5-x86_64This can also be used in one of my previous posts: Remove duplicate packages when querying the rpm database.

Read More