Skip to main content


If "user_name" is a user in server "" and you want to setup ssh key to this server and also able to login to this server using ssh key only.
Follow these command in the command line.

1) cd /home/user_name (user_name is the name of the user)

2) mkdir -p .ssh

3) chmod 0700 .ssh/

4) ssh-keygen -t rsa

Result printed will be something like below:

Generating public/private rsa key pair.                                        
Enter file in which to save the key (/home/user_name/.ssh/id_rsa):            
Enter passphrase (empty for no passphrase):                                    
Enter same passphrase again:                                                  
Your identification has been saved in /home/user_name/.ssh/id_rsa.            
Your public key has been saved in /home/user_name/.ssh/            
The key fingerprint is:                                                        

5) You can enter any key name as your wish. If you skip this, by default it will be given "id_rsa".
You can also give a passphrase to your key to make more secure. You can also skip this.

Your public key will be "" in .ssh folder. Private key will be "id_rsa(or you_entered_name)" in the same folder.

6) Check "authorized_keys" file exist in .ssh folder. If not type this command "touch .ssh/authorized_keys". Typing this command even though authorized_keys will not delete the data in authorized_keys file.

7) scp .ssh/

Result printed will be something like below:

The authenticity of host ' (' can't be established.         
RSA key fingerprint is 5d:0f:b5:8e:d9:a4:4b:d0:1c:3f:b6:35:1d:44:89:27.          
Are you sure you want to continue connecting (yes/no)? yes                       
Warning: Permanently added '' (RSA) to the list of known hosts.'s password:                                                                                                                                                                   100%  421     0.4KB/s        00:00                                                                           

8) chmod 0600 .ssh/authorized_keys

Private ssh key is deploid in your server for this user. Please download "id_rsa" file from .ssh folder.

9) Later make .ppk file from this "id_rsa" file from "putty gen" software. .ppk file generated will be private key for your server login.

10) In the command line,

nano /etc/ssh/

11) Open sshd_config file from this folder using any of editor. I prefer vi editor.

vi sshd_config

12) In this file , set "PasswordAuthentication" to "no"

13) Finally restart the ssh.

/etc/init.d/sshd restart to restart ssh

14) Now you can login to your server using ssh key without entering your previous password.


Popular posts from this blog

Setup Asterisk 13 with FreePBX 13 in CentOS 7

Launch CentOS 7 AWS Ec2 InstanceLog in to your aws consoleGo to ec2 management page and click Launch Instance on Instance pageIn Choose AMI step, go to AWS MarketPlace tab and search CentOS 7 on search field. List of centos 7 ami's will be available.Select CentOS 7 (x86_64) ami which is free tier eligible. Select your instance type and click configure instance. Keep default values from Configure Instance to Add Tags stepsIn configure security group, create a security group which allow minimum ports openSSH : port 22HTTP : port 80Custom UDP Rule : 10000-20000 (if you are giving RTP ports 10000-20000)Custom UDP Rule : 5060 (ChanSIP port)Custom TCP Rule : 5060 (ChanSIP Port)Click Launch Instance. Select your key file and accept terms to launch instance.
Setup CentOS Server SSH into newly created CentOS server with username centos and your key file.Update all existing packagessudo yum update -yNow start http service(you can access your server via browser by going to your server ip addres…

Start an android activity from cordova plugin

We all need to start an android activity from a cordova plugin. Here is a small and complete code to start an activity from cordova plugin
1. Install plugman to create cordova plugin npm install -g plugman2. Create cordova plugin using plugman plugman create --name PluginName --plugin_id com.example.sample.plugin --plugin_version 0.0.1
N.B : plugin id never start with Uppercase Now PluginName directory will be created. Plugin structure will be
> PluginName/

> |- plugin.xml

> |- src/

> |- www/PluginName.js

3. Add android platform to plugin
plugman platform add --platform_name android
Now plugin structure will be

> PluginName/

> |- plugin.xml

> |- src/android/

> |- www/PluginName.js

4. Now create a java file named in src/android diretory
This activity will be shown using our plugin. Write sample activity in
package com.example.sample.plugin; import; import android.os.Bundle;…

Implementing Client Side WebRTC using Sipml5 javascript

Step 1:

Download and require Sipml5 library function.

Step 2:

Initialize sipml5 Engine in your web page :

var readyCallback = function(e) {
// function called when sipml is successfully initialised.
createSipStack(); // calling this function to create sip stack(see below)

var errorCallback = function(e) {
// function called when error occured during sipml initialisation.

SIPml.init(readyCallback, errorCallback);

Step 3:

Create Sip Stack :-
Sip Stack is an object that must be created before making/receiving call and sms. Creating Sip stack is an asynchronous process, so you need to create an event listener function to get state change notification.

var sipStack;

function EventListener(e) {

* e.type ;type of event listener
* e.session ; current event session
* e.getSipResponseCode() ; event response code
* e.description ; event description

if(e.type == 'started'){
// successfully started the stack.
} else if(e.type == 'i_new_call'){
// when new incoming call comes.