Pay attention to ARP Poisoning in your network.

“The cruelest lies are often told in silence.”
— Robert Louis Stevenson

Disable IPv6 on CentOS 6

Just add or edit the lines below to the relevant files.

/etc/sysctl.conf  :  net.ipv6.conf.all.disable_ipv6 = 1
/etc/sysconfig/network  : NETWORKING_IPV6=no
/etc/sysconfig/network-scripts/ifcfg-eth0 : IPV6INIT=”no”

If you have a different interface than eth0, just replace the last line above with it.

Now you don’t need to reboot your server (as everybody else says on the internet), simply restart the network service and you’re good to go.

service network restart

Don’t forget that, since you’re not using ipv6 anymore, you can disable the ip6tables if active, to avoid extra resource usage.

service ip6tables stopchkconfig –level 345 ip6tables off

Mounting NTFS USB Disk on CentOS

You might get a warning unknown file system type ‘ntfs’ when trying to mount an NTFS disk on a CentOS server.

EPEL Repositories

To overcome this issue, you need the epel repositories enabled. If you haven’t done this before, just get the epel rpm file from the websites below and import them using rpm.
Note that the rpm files are different for CentOS 5 and CentOS 6.

#CentOS 5
#CentOS 6

Get them via wget. If you get an error saying there is no such file, just browse the directory listing to get the exact version.

After downloading them, import them like this:

rpm -Uvh epel-release-*.rpm

Now we have EPEL enabled.

Install ntfs-3g and fuse

Now we should install the ntfs-3g and fuse packages using yum.

yum install ntfs-3g ntfs-3g-devel fuse fuse-devel fuse-libs

Mounting and Unmounting

Now you can simply mount and unmount the ntfs file system.

/sbin/mount.ntfs-3g /dev/sdb1 /media/usb
umount /dev/sdb1

Of course the lines above assume you have the device /dev/sdb1 as the usb, and you have created a folder /media/usb.
You can see that unmounting is also quite simply, just like an ordinary disk.

Removing the EPEL Repo

If you don’t want to keep EPEL in your repo for some reason, you can simply remove.

Find the packages name using grep, assuming it is epel-release-6-8 you can use the commands below:

rpm -qa | grep epel
# output is epel-release-6-8
yum remove epel-release-6-8
yum clean all

Cisco Router Backup Script With Python and Telnet

We needed a simple way to backup our network settings on a Cisco device at Veriteknik, so I decided to write a script.

You can simple connect to the device via telnet, declaring your username and password. For security reasons, we use IP address restricting as well.

So, it is quite easy to send and recieve telnet commands in Python, simply use the telnetlib library.

Getting the settings of a Cisco device is quite easy, simply enter the “sh run” command and the output is your settings. But normally the device will output the settings in bits and pieces, using a “more” like function. This is set on the terminal length parameter. To check it, simple use the following command on your device, terminal | in Length
Length: 62 lines, Width: 195 columns

To set this value to 0, which means you’ll get the full output instantly,

terminal length 0

This command will change the option, but that is only for the current session. When you relog to the device, the value will be set to default, which is a good thing cause we want only our Python-Telnet session to get a non-more-like terminal mode. You can read about this on Cisco’s documentation here.

Now using the script below, we can simple get our backups. This script is for Python 2.x, it won’t be that different if you want to use it with 3.x either.


import telnetlib
import datetime

now =

host = "" # your router ip
username = "administrator" # the username
password = "SuperSecretPassword"
filename_prefix = "cisco-backup"

tn = telnetlib.Telnet(host)
tn.write("terminal length 0"+"\n")
tn.write("sh run"+"\n")

filename = "%s_%.2i-%.2i-%i_%.2i-%.2i-%.2i" % (filename_prefix,,now.month,now.year,now.hour,now.minute,now.second)


This script will output a file with a timestamp. This file will contain all the settings (actually the “shell run” output) of your device. Now why not give it a try with a cronjob?

A Backup Script For WordPress

I’ve written a backup script in order to get my WordPress blog backup automatically. The script is only usable on a Linux/Unix box, since it uses default GNU tools.

The script connects to the server via ssh, copies a folder to a location, dumps a database to the same place with the copied folder, creates a tar.gz out of it, then gets the new file via ftp to a prefered location.

The important thing here is that, you should add your ssh public key to the server so that ssh will connect automatically. I also use .my.cnf files to login mysql without specifying password, so you’d better do that. I’ve talked about it in an earlier post here.

Keep in mind that you need an ftp client to connect. If you don’t have it, install it using yum, apt or whatever.


HOST='' # ip address of your server
SSHUser='root' # user to connect as ssh
FTPUser='myfunkyftpusername' # user to connect as ftp
FTPPass='mysupersecretFTPpassword!' # ftp connection password
MYSQLUser='root' # # user to connect as MySQL

SSHPort=22 # change if different
FTPPort=21 # change if different
DB=wordpress # which database to backup?
DIRECTORY='/home/eaydin/public_html/wp-content' # directory to back up - server side
DIRWRITE='/home/eaydin/' # move the backup here on the server.
DROPBOX='/home/eaydin/Dropbox' # local file path to backup - host side. use your Dropbox folder?
FILENAME='wp-backup' # Filename to use for backups

DIRWRITE=${DIRWRITE%/} # remove trailing / from dir name.
FILENAME=${FILENAME%/} # remove trailing / from filename in case the user types it.
DATE=`eval date +%d%m%Y"-"%H%M` # create date format. (created on the host side, not server. depends on the host time setings.)
FILETAR=$FILENAME-$DATE.tar.gz # name of the tar.gz file (not path!)

ssh -t $SSHUser@$HOST -p $SSHPort "\
mysqldump --add-drop-table -u $MYSQLUser $DB > $DIRWRITE/$FILENAME-$DATE/wordpress.sql ;\
chown $FTPUser:$FTPser $DIRWRITE/$FILETAR ;\
ftp -n $HOST $FTPPort <<END_SCRIPT
quote USER $FTPUser
quote PASS $FTPPass
exit 0

The lines between 5 and 17 are the ones you should edit, they’re all self explained in the comments.

It’s a good idea to add the script to your crontab.
In order to do it, especially on Ubuntu systems, just add your current PATH value right below the /bin/sh line. Like this,

eaydin@eaVT:~$ echo $PATH

So you should add this line at the top of the script,

#!/bin/env bash

Or, just run the script whenever you want. I usually set the download path (defined as the $DROPBOX variable on line 16) to my Dropbox folder, this way my backups get automatically synced on the Dropbox server.