Keep your SSH sessions alive

September 4, 2013 at 11:12 am Tags:

Most Internet service provider will try shutdown active Internet connections after a view minutes to prevent their network from streaming videos or other bandwidth killers. This happens often because of some router setting you can’t change. As a web developer your SSH session (and other active connections) will freeze, if you stop working in the terminal window for just 5 minutes or by getting a fresh cop of coffee.

To get rid of this problem you need to change your SSH config file, enter the following inside to the terminalwindow

sudo nano /etc/ssh/ssh_config

and add this setting to the end of the file

ServerAliveInterval 60

Safe your file and start a new SSH session which will stay active because the client sends every 60 seconds a bit of data to the server.
Check also this article for more information.

Optimize Apache and MySQL for a 256MB VPS

September 1, 2011 at 7:09 am Tags: | | | |

For small websites or not so popular WordPress blogs a small VPS with only 256MB of RAM should be enough. If you’ve followed this guide to install a Ubuntu web server you need to optimize your server a little bit.

Start installing MySQLtuner

Download the Perl script to your (admin) home directory:


Create also a file nano .my.cnf and add this code:


After running MySQLtuner script perl you should get this warning:

Reduce your overall MySQL memory footprint for system stability

To resolve this an other memory related issues we need to optimize the MySQL database settings. Read More…

SSH Authentication without entering a password

August 9, 2011 at 10:43 am Tags: | | |

Follow the instructions below to create and install a SSH public key on your remote server. After you followed these steps your able to login via SSH without entering a password. This is extremely useful for backups with rsync or for other automatic tasks you like to execute.

  1. Change to your user’s home directory (local system)
    cd ~
  2. create a pair of private keys
    ssh-keygen -f .ssh_key -t rsa -N ''
  3. *** upload the public key to the remote system using rsync via SSH
    rsync -e ssh ~/
  4. login to your server via SSH using the command line or Putty
    ssh user@YourServer (you need to enter your password too)
  5. check if the .ssh directory exists, if not create it
    mkdir .ssh
  6. add the public key to the user authorized key files
    cat >> .ssh/authorized_keys
  7. remove the uploaded key from your home directory (remote system)
  8. test your new “private” connection
    rsync -avz -e "ssh -i .ssh_key" "someFolder" user@YourServer

Now you’re able to access the remote system (YourServer) from your local system without using a password. This tutorial is for Linux only.

*** UPDATE: 12th december 2011

If you can’t create a persistent SSH connection to you backup server this way you need a small workaround:

After the creation of your “local” keys you need to download the “authorized_keys” file from the backup server
rsync -e ssh user@YourServer:.ssh/authorized_keys ~/authorized_keys (check the exact locations first)

Now add your public key to the downloaded file
cat >> authorized_keys

Upload the modified “authorized_keys” file to the backup server
rsync -e ssh ~/authorized_keys user@YourServer:.ssh/authorized_keys

Remove the downloaded file and test you connection like described in step 8.

How-to create a virtual host in Apache (Ubuntu)

July 25, 2011 at 9:21 pm Tags: | | |

You will find on most Linux based web hosts a directory which is called “sites-available” (inside /etc/httpd/ or /etc/apache2/). Create a configuration file with the name “” for your host and add this code:

ServerAdmin webmaster@localhost
DocumentRoot /home/user/
ErrorLog /var/log/apache2/
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel warn
CustomLog /var/log/apache2/ combined

Create the directory for your web host and activate the host with a2ensite and reload your apache engine.

How-to restore email messages from Uebimiau or T-dah webmail

May 30, 2011 at 1:37 pm Tags: | | |

I have a few servers where DirectAdmin is used as the control panel and it seems that Uebimiau (or T-dah) is used as default webmail client. Unlike other e-mail clients Uebimiau will download your e-mail messages like a local mail client and stores them in Uebimiau directories. That will say if you need to check your mail from some other computer using Uebimiau as web mail client, you can’t download them again on your “regular” computer using Outlook for example.

But there is also good news Uebimiau stores those e-mail messages in the “original” mail format, that will say you’re able to copy/move them from the Uebimiau directory to your IMAP or POP3 folder (on the mail server of course)

How-to move the messages (on a DirectAdmin server)?

  1. Locate the Uebimiau directory: /var/www/html/webmail/tmp/info_domainname.com_localhost
  2. Copy the messages (extension .eml) from the folder called “inbox” to the folder to the e-mail directory inside the users home directory: /home/username/imap/

VOILA! After this your e-mail messages are available again… and don’t forget to ignore Uebimiau the next time. If your server is based on DirectAdmin, use this kind of URL instead and use Squirrel: http://hostname/squirrelmail

Download, extract and move a tar.gz file

May 3, 2011 at 2:46 pm Tags: | | | |

Downloading some script or application using WGET is a common an quick way to start some web application or website. In my case I can’t remember me parameters I don’t use very often.

For example we like to install WordPress right into our public_html directory (not into a sub-directory), move to the website’s root directory first:

# cd /home/username/public_html/

Download the application from the WordPress website: Read More…

Page 1 of 212