Configure SSH-Keybased Auth

Loginto Remote Server and Configure SSH-Keybased Auth
------------------------------------------------------------------------------------------------

# ssh-keygen
# cd ~/.ssh/

 
Add/Append generated Public key to "authorized_keys"file

# cat id_rsa.pub >> authorized_keys
# chmod 600 authorized_keys

 
Copy Private key to Local Client System(from where to connet to this server)

# scp id_rsa ubuntu@192.168.1.222:/F1/SSH-KeyS
# vi /etc/ssh/sshd_config

..
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
PasswordAuthentication no

#
# service sshd restart
#exit


From Local Client System login to server using key file

$ mv /F1/SSH-KeyS/id_rsa /F1/SSH-KeyS/owncloud.key
$ sudo chmod 400 /F1/SSH-KeyS/owncloud.key
$ ssh -i /F1/SSH-KeyS/owncloud.key root@192.168.1.95


============

For Quick Access to Server from Client Machine
-------------------------------------------------------------------------------


Open or create ~/.ssh/config file on client.and then paste following line replacing "owncloud" with the id you want to use and location to .key file with correct one.

# vi ~/.ssh/config
#---Host OwnCloud---#
Host owncloud
HostName 192.168.1.95
User root
IdentityFile "F1/SSH-KeyS/owncloud.key"
#---Host UB-Router---#
Host router
HostName 192.168.1.99
User ubadmin
IdentityFile "/F1/SSH-KeyS/router.key"

#

You are ready to go. Just type:
# ssh owncloud