SSH without password

January 19th, 2012 § 0 comments § permalink

Did u think it is awful to enter password everytime while logging into a linux system via ssh?
In another case If you want to ssh from shell script, the password prompt will be an issue.
Here is the way you can get rid of it, But this have high security issue so please don’t use this on public computers.

Disclaimer : I am just sharing my knowledge and I won’t be responsible for any loss of data or anything by using this trick. Use this at your own risk.

Steps to follow are,

  1. Generate ssh public and private keys

    You can easily Generate public and private keys using the command

    ssh-keygen -t rsa

    Just press enter to all the data asked while generating the keys, so that default values will be taken. Make sure you didn’t provide any passphrase for it.

  2. Copy the public key from ~/.ssh/id_rsa.pub

    You can use any text editor to open the file ~/.ssh/id_rsa.pub and copy the key. I prefer to use cat command in terminal.

  3. Login into remote system

    This will be the last time you login into that system using password.

  4. Open the file ~/.ssh/authorized_keys if it exists

    Check whether ~/.ssh/authorized_keys file already exists in the server else you need to create a new one. You can easily create a file using the command

    touch ~/.ssh/authorized_keys
  5. Paste the key and save it

    Paste the key (which you copied earlier) in a new line, at the end of file and save it.

Now please logout from the remote server and try to login again. Now ssh won’t ask for password.

You can try to ssh from shell script also.

Why you should use Terminator over Terminal

December 19th, 2011 § 0 comments § permalink

Hope you are a terminal user and hope you can’t survive on linux without terminal. But now I introduce another application which can save your time while using Terminal. Just read on to see why I prefer Terminator over terminal?

  1. Multiple GNOME terminals in one window
    You can easily divide your terminator screen horizontally or vertically so that you can easily switch to another. I think more easily than switching tabs.
  2. Drag and drop re-ordering of terminals
    You can easily Drag & Drop each terminal windows and rearrange the appearance.
  3. GUI preferences editor
    Teminator provides you a neat and easy preference editor, so that you can easily edit the preferences such as short-cuts,fonts etc. The plugins tab allows you to Enable and disable various plugins available for terminator.

    Preference editor

    Preference editor

  4. Arrange terminals in a grid
    I already told you can divide vertically and Horizontally. You can arrange the terminals as a grid by dividing horizontally and Vertically any number of times you like and not bad on your screen.

    Arrange in Grid

    Arrange in Grid

  5. Opensource
    Yes Terminator is a purely an opensouce project and you can find full code here (https://code.launchpad.net/terminator/). You can contribute and
    report bugs.

Adding virtual host in apache on ubuntu

September 28th, 2011 § 0 comments § permalink

Here is the simple tutorial which helps to set up virtual host in apache on your Ubuntu. I assume you have a bit idea on apache and basic commands on ubuntu and vim. It also assumes that you already installed apache and vim.

  1. Create a file in /etc/apache2/sites-available

    To create a file in this location you need root privilege. so don’t forget to use sudo. You can give any valid file name (without any extension) except default and default-ssl. Use the following command to create it.

  2. Open the file.

    Here I am using vim editor for convenience. You can use any editor but make sure, you run the editor as root.

  3. Get into insert mode by pressing “i”.

    Skip this step if you are not using vim editor.

  4. Copy the following text into the editor

    You need to change the Document root (/home/phprepo/www/my-works) with the absolute path to your project folder.

    If you have already given 127.0.0.2 to some other virtual host then you need to provide some other for this host. Now save and Quit the editor. You can use exit the insert mode using Esc and use “:wq” for save and exit.

  5. Enabling the virtualhost

    By step 5 you created the virtualHost. Now you need to enable it. You can use following command to enable it.You need to restart apache after enabling it.

    In future if you want to disable you can use sudo a2dissites my-works

  6. Restart apache

  7. Add virtual host to hosts file

    Open /etc/hosts and get into insert mode. paste the following line

    Since 127.0.0.1 is already given to localhost you need to give a different one for our virtual host.But make sure you need to provide the same in the virtualhost file too.(<VirtualHost 127.0.0.2:80>)

Now take a web browser and type http://my-works/ this will redirect to your document root.

Install redis server on ubuntu

July 12th, 2011 § 0 comments § permalink

Here is the step by step procedure for installing redis server.
If you have git installed on your ubuntu then clone it from github else download from here

git clone https://github.com/antirez/redis.git

Now change the directory into cloned/downloaded redis directory

cd redis

use make command

make

Use make install to install the redis server

sudo make install

Thatz all you have installed redis server.now you can run it.

redis-server

Try the redis client by using the command

redis-cli