Secure Shell (SSH) protocol is used for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network. This quick guide explains you how to login into remote server or client machine using SSH.
SSH login with IP address and Password
#ssh <username>@<ipaddress>
#ssh <ipaddress>
For example :
#ssh root@192.168.1.10
#ssh 192.168.1.10
SSH login with ip address and ssh key ( pem key )
#ssh -i <key> <username>@<ip_address>
For Example:
#ssh -i myserver.pem root@192.168.1.10
SSH login with DNS and ssh key ( pem key )
#ssh -i <key> <username>@<dns>
For Example:
#ssh -i myserver.pem root@ec2-xxxxxxx.compute-1.amazonaws.com
#ssh -i myserver.pem root@abcdefg.com
SSH login with port number
#ssh -i <key> <username>@<ip_address> -p <port_number>
#ssh -i <key> <username>@<dns> -p <port_number>
#ssh <username>@<ip_address> -p <port_number>
#ssh <username>@<dns> -p <port_number>
For Example:
#ssh -i myserver.pem root@192.168.1.10 -p 2018
#ssh -i myserver.pem root@ec2-xxxxxxx.compute-1.amazonaws.com -p 2018
#ssh root@192.168.1.10 -p 2018
# ssh root@abcdefgh.com -p 2018
If you want to login to remote machine frequently with ip address, then it is wise to add it in /etc/hosts
vim /etc/hosts
192.168.1.10 sathish
save and quit the file.
Now login with name instead of ip address
For Example
#ssh root@sathish
#ssh sathish
It will check the entries in /etc/hosts file and trying to login with appropriate details.