search instagram arrow-down





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“.

Leave a Reply
Your email address will not be published. Required fields are marked *

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: