SSH
- It is Secure Socket Shell.
- It allows you to connect securely to a remote computer by using a text-based interface.
Linux Machine
- sudo apt install openssh-server openssh-client
Create SSH Key
ssh-keygen –t dsa
Enter where to save key = Default press Enter
Enter passphrase = which will be your key {press enter}
Cd ~/.ssh
Hidden directory where key is stored and keep list of safe ssh hosts.
It has two files
id-dsa = private key
id_dsa.pub = public key which can be distributed safely.
Change the permission for the given folder
chmod 700 $HOME/.ssh
chmod 600 $HOME/id_dsa*
Copy this file to remote device home directory
Cat .ssh/id_dsa.pub | ssh root@192.168.0.2 ‘cat >> .ssh/authorized_keys’
Relogin
If you are prompted for passphrase,
You are successfully configured key based authorization.
When you are trying to connect to remote host for the first time, System will ask us to store the id to the known_host list. Once it is added, it will not ask from the second time.
All the known hosts hashed key are stored in the file ~/.ssh/known_hosts
Initially all the host id are stored in the hashed way. If you want the ip address to be visible to user, just edit the following
Change to root user
vi /etc/ssh/ssh_config
Change the following HashKnownHosts yes to HashKnownHosts no
Once it is edited, ip address of the known host are visible.
Windows Machine
- Install puTTy or any other similar software.
- It follows the same procedure of creating the key and establishing the communication.

No comments:
Post a Comment