Friday, April 3, 2009

SFTP using SSh: Key pair generation

ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine. It is intended to replace rlogin and rsh, and provide secure encrypted communications between two untrust-ed hosts over an insecure network. X11 connections and arbitrary TCP ports can also be forwarded over the secure channel.

ssh-keygen generates, manages and converts authentication keys for ssh(1). ssh-keygen can create RSA keys for use by SSH protocol version 1 and RSA or DSA keys for use by SSH protocol version 2. The type of key to be generated is specified with the -t option. If invoked without any arguments, ssh-keygen will generate an RSA key for use in SSH protocol 2 connections.

Normally this program generates the key and asks for a file in which to store the private key. The public key is stored in a file with the same name but ``.pub'' appended. The program also asks for a passphrase. The passphrase may be empty to indicate no passphrase (host keys must have anempty passphrase), or it may be a string of arbitrary length. A passphrase is similar to a password, except it can be a phrase with a se-ries of words, punctuation, numbers, whitespace, or any string of charac-ters you want. Good passphrases are 10-30 characters long, are not simple sentences or otherwise easily guessable (English prose has only 1-2 bits of entropy per character, and provides very bad passphrases), andcontain a mix of upper and lowercase letters, numbers, and non-alphanu-meric characters. The passphrase can be changed later by using the -p option.

Option argument :
-t type
Specifies the type of key to create. The possible values are
``rsa1'' for protocol version 1 and ``rsa'' or ``dsa'' for proto-
col version 2.

Steps:
1. Run "ssh-keygen -t dsa", two files will be generated: id_dsa.pub and
id_dsa.

2. Run ssh-keygen -e -f id_dsa > SSH_id_dsa.pub

SSH_id_dsa.pub file than can be send to the remote place with which you are going to communicate.

No comments: