Email Alert on SSH Login

by Nish Vamadevan

The following method can be used when a user login to a linux machine, an email will be sent with IP information. For this to work, you need to have the program mutt installed. Then add the following to the user’s .bashrc file, which is located in /home/$user/.bashrc echo `who` | /usr/bin/mutt -s “SSH Alert” [...]

Read the full article →

Daily MySQL Database Backup & Email

by Nish Vamadevan

The following two scripts on crontab will automatically back up and email the database on a timely manner. This script will work on daily backup of Blogs such as WordPress / Drupal etc In this example, I will be using the directory /home/backup/database It is recommended to create two different shell script named dbback.sh and [...]

Read the full article →

Passwordless SSH Authentication on Linux

by Nish Vamadevan

There are two ways of achieving passwordless authentication on a Linux Box. On Debian/Ubuntu you can just type: $ cd $HOME ~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key: Press Enter each question and you will have a pair of keys ready to use. You will be asked [...]

Read the full article →

Quick tip: change default text editor on Linux shell

by Nish Vamadevan

Doing visudo you get nano instead of your favorite text editor? Mine is vim therefore I issue: DEBIAN/UBUNTU way # update-alternatives –config editor There are 4 alternatives which provide `editor’. Selection Alternative ———————————————– 1 /usr/bin/vim.tiny 2 /bin/ed *+ 3 /bin/nano 4 /usr/bin/vim.basic Press enter to keep the default[*], or type selection number: Selecting 4 I’m [...]

Read the full article →

How to install Debian from USB drive

by Nish Vamadevan

I’ve come across multiple ways of doing it but so far the best way is the following (I assume you are on i386 platform and you have access to the net): 1. Download boot.img.gz from Debian website 2. Download the net-install image choosing i386. 3. Plug your USB drive into a Linux PC, open the [...]

Read the full article →

How to change the file timestamp on Linux

by Nish Vamadevan

This tip might comes handy when you do a system check and you want to make sure you don’t check the same file twice. Let’s pretend that our “file1″ is a conf file that needs review. As you can see the output of the command issued below shows that the file was last edited in [...]

Read the full article →