Passwords are a risky authentication method while communicating remotely. A better way is using SSH.
SSH is a network protocol to securely access remote servers. It employs following techniques:
- Asymmetric encryption: to authenticate the client using private/public keys.
- Symmetric encryption: once the authentication is done, a shared session key is generated using Diffie-Hellman key exchange algorithm which is used to encrypt/decrypt all communciation.
- Hashing: to maintain data integrity.
To login to remote server using SSH without passwords, the client needs to generate a keypair and copy the public key to server’s authorized_keys
.
- Generate private/public keypair on the client machine
|
|
- Copy the public key from client machine to remote host
Now forget the password and simply login using ssh 'username@remote_host_ip'
.