Posts Categorized: linux

Fabric: Getting Started Tutorial

Hopefully this may help someone else out there who is looking for a good excuse to use Fabric in anger. I install Fabric on my local Ubuntu desktop using: sudo apt-get install fabric With Fabric installed I created a new directory for playing around and inside that folder created a file named fabfile.py as follows:… Read more »

Top of the Tops 2013

A revised list of my favourite ‘tops’ htop htop can provide a little more info than the traditional ‘top’ – I like how it shows the amount of memory usage minus the cache. iftop To check network connectivity use iftop: iptraf Like iftop but with more options and even the ability to show traffic by… Read more »

Some Linux LPI 102 Exam Questions

I just passed my Linux LPI 102 exam today and thought I would try to remember a few of the 60 questions in case I ever have to take a refresher – here is about half of them. I can’t remember the wording exactly for these questions so take with a pinch of salt: 1…. Read more »

Command Line Wireless Trouble-shooting

I wanted to compare the command line output of a working Wifi connection versus a connection at a location that was giving us trouble. To do so I used Ubuntu (12.10) on a laptop and used the following commands – in a script if necessary. First a configuration file to use with the wpa-supplicant –… Read more »

Fail2Ban Custom Action

I decided to experiment with creating a central database to hold the IP addresses banned by various servers / honeypots running Fail2Ban – so that the information could be used as a source for IPtables or TCPWrappers to protect other servers. I created the file /etc/fail2ban/action.d/qshield.conf and in it placed the following: [Definition] actionstart =… Read more »

Dynamic DNS to Raspberry Pi

I now have my Raspberry Pi hanging off my router – just two cables – a USB cable to the USB port on the router for power and one ethernet cable. 1. Static IP Address I edited the file: /etc/network/interfaces replacing: iface eth0 inet dhcp with iface eth0 inet static address 192.168.1.51 netmask 255.255.255.0 gateway 192.168.1.1… Read more »

FFmpeg Convert FLV to AVI

I was having difficulty converting an FLV file saved from iPlayer. The command to successfully convert the file was: ffmpeg -y -i input_video.flv -ar 22050 -b 2048k -f flv output_video.avi

Samsung TV Channel Editing

samtoolbox

I wanted to configure the channel numbers on my Samsung LE40C580 but using the remote control on the TV was a bit frustrating. I found that within the TV menu I could export/import the channel list to a USB drive. Changing the file extension to .zip allows extracting the file to view the contents: I discovered… Read more »

Bash Shell Script to Automate FTP File Transfer

A little script to send a backup file to a remote FTP server: #!/bin/bash HOST=’123.111.123.111′ USER=’bak_user’ PASSWD=’OpEnSeSaMe’ TODAY=”$(date +”%Y%m%d”)” FILENAME=Hostname_$TODAY.tgz cd /var/backup/sched/ ftp -n -v $HOST << EOT ascii user $USER $PASSWD prompt cd backups put $FILENAME ls -la bye EOT Then run it every day from Cron.

IPTables Custom Chain for SSH access

I wanted a custom IPTables firewall chain to allow SSH access to a machine. The idea is that users hit a web page that adds their dynamic IP address to a list and then a script inserts that IP address into IPTables to allow SSH access. I achieved this as follows. In /etc/sysconfig/iptables I added: *filter… Read more »