Password based Authentication are considered to be vulnerable in the Network world. You are highly recommended to use ssh key based Authentication. SSH uses public key cryptography, that uses  public key and private keys.

On the client Machine:

$ ssh-key-get -t rsa

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/mac/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/mac/.ssh/id_rsa.
Your public key has been saved in /Users/mac/.ssh/
The key fingerprint is:
14:87:b3:26:cc:eb:79:05:09:97:16:35:3e:f3:1e:9b mac@Macs-MacBook-Pro.local
The key’s randomart image is:
+–[ RSA 2048]—-+
|        o=+      |
|      . *+ .     |
|     o +.++      |
|      +.=  +     |
|       +S.  o    |
|      .   .. +   |
|     . . .  E    |
|      o .        |
|       .         |
Macs-MacBook-Pro:~ mac$

Server Machine:

  1. In the server, copy the public key(  inside ~user/.ssh/  as authorized_keys.
  2. Edit /etc/ssh/sshd_config to reflect PasswordAuthentication no.
  3. From the client you can ssh as ssh -i id_rsa user@server.
  4. For protecting the private key, you can use ssh pass phrase. Which acts as extra security features for ssh.

Note: Private key is used in the client, you used to access the system, the public key remained in the Server, as authorized_keys.

Resume scp:

Sometime we may have to resume the scp when connection are terminated accidentally. It can be easily done with the use of rsync:   rsync --partial --progress --rsh=ssh user@host:/Remote_File Local_File


rsync is a file transfer program in UNIX based system that synchronize the files and directories from one system to another. It uses the delta encoding when possible to minimize the data transfer time.

  1. rsync -alovzrP –delete -e ssh user@host:Remote_File  Local_File
  2. rsync -alovzrP Local_File user@host:/Remote_File

rsync Push Operation:

Pushes directory from local system to remote system.

rsync -a ~/dir1 username@remote_host:destination_directory

rsync Pull Operation:

rsync -a username@remote_host:/home/username/dir1 place_to_sync_on_local_machine

Pull directory from remote system to local system.

Important Note:

rsync -a dir1/ dir2

This is necessary to mean “the contents of dir1“.

Colorful Message in Console

For the colorful text in the Linux console you have to use the escape sequence code.You can use echo statement to print message, to use ANSI escape sequence you must use -e option (switch) with echo statement, general syntax is as follows


echo   -e  “33[escape-code    your-message”

33, is escape character, which causes to take some action

After [ you would place a decimal no. and a letter for a specific action.

eg1. echo -e “33[31m This text is in Red:”

eg2. echo -e “33[32m This text is in Green:”

30-37 Set foreground color.

m useful to show characters in colors or in different effects such as bold.


To reset the color to normal,  use the command:

tput sgr0


For detail:



Quotes are really confusing and we don’t know where to use the correct one.
Here I try to describe it in very concise way.

”  Double quote:   (weak quote)
‘   Forward Tic  (strong quote)
`  Back Tic:  (Located on the left of the 1 key). command substitution.
\   Single character substitution
?  Match one character

daya@debian:~$ echo “This is my test on $HOSTNAME”
This is my test on debian

daya@debian:~$ echo “This is my test on \$HOSTNAME”
This is my test on $HOSTNAME

daya@debian:~$ variable1=`ls /home`
daya@debian:~$ echo $variable1—-> list the content of home directory.

daya@daya-laptop:~$ echo ‘This is my $HOSTNAME’
This is my $HOSTNAME

positional parameter:
$0 —> program name
$1 —> first argument
$2 —–>second argument

$9—–> 9th argument

$#—–> no. of arguments
$* ——> all arguments
$?—>return code