Ok now we have a situation where I need to ssh to host ROUTER everytime with a
username which is not the one i use on CLIENT system
Say on the CLIENT system my username is jack and the username on ROUTER is
sparrow ith a different password, the passwordless authentication with
public/private keys are not going to work as teh usernames differs and how we
can over come this situation
So now we are logged in CLIENT system as user jack
lets create the encryption keys for this user. Please use -b for the keylength
of encryption. Lets create a 512 bit encryption keys. Remember dsa is limited to
1024 bits but rsa doesnt have any such limits, but a 1024 bit keys is more than
sufficient and may a bit over kill. If you trust google and bank sites with 128 bit key then why to be so much worried.
$ssh-keygen -t rsa -b 512
Ok this will create a rsa encryption based public key
key < id_rsa> and now keep ur private key ( id_rsa) very safe
Lets copy the public key id_rsa.pub to the remote machine through scp or any
means and append it to authorized_keys file in .ssh folder
Ok if you test it you can see it still asks for password bcoz the user ids are
different in both systems, so how we can solve it
in CLIENT system, in user jacks folder's ssh folder create a file called config
which can cotain entries as follows
Content of config file in .ssh
Hostname
User
Port < ssh port if its running on other than 22>
So our sample config file may contain like this
Host ROUTER
Name sparrow
Ok thats all and now its time to test it guys
IF you have done it this much without any fail then you must be seeing a ssh
console of ROUTER
Thats simple ssh lesson for all of us