Linux

Generate a /etc/hosts file from the command line

This is a simple example of how you can populate a /etc/hosts file with 100 IPs and hosts from the command line # N=1; for i in $(seq -w 100); do echo “192.168.99.$N host$i”; P=$(expr $P + 1); done >> /etc/hosts The result file /etc/hosts 192.168.99.201 host001 192.168.99.201 host002 192.168.99.201 host003 192.168.99.201 host004 192.168.99.201 host005 […]

Read More
Linux

Fix slow SSH login

Add the following line if your SSH login takes a long time on your SSH server. File /etc/ssh/sshd_config: UseDNS no Restart the SSH daemon to activate this change.

Read More
Linux

Some iptables tricks

Multiport The Multiport extension allows you to specify multiple ports and ranges and makes it possible to create complex rules in one line. Here’s an example of how you can allow SSH, Web, IMAP and X terminal traffic iptables -A INPUT -p tcp -m multiport –dports 22,80,143,6000:6003 -j ACCEPT The alternative to using this rule […]

Read More
Linux

Using ufw / iptables in Ubuntu 8.04 LTS

ufw (Uncomplicated Firewall) is a new and easy firewall/iptables tool introduced in Ubuntu 8.04 LTS (Hardy Heron). ufw is a front-end for iptables-restore, with its rules saved in /etc/ufw/before.rules, /etc/ufw/after.rules and /var/lib/ufw/user.rules. Administrators can customize before.rules and after.rules as desired using the standard iptables-restore syntax. Rules are evaluated as follows: before.rules first, user.rules next, and […]

Read More
Linux

Create a photo collage using imagemagick

I use imagemagick to create index images to my photo albums to get a quick overview without looking through all the pictures. This is how I create a simple photo collage using imagemagicks montage command montage -label ‘%t\n%wx%h’ -resize 150×150 ‘*.JPG’ -geometry +3+3 -tile 3x -frame 5 _Index.JPG

Read More