Note – I am using a Mac system for this short guide.
- SSH, Secure Shell, is used for establishing a secure connection to the remote system.
- It incorporates various encryption method to ensure the safety of the sessions, or data to be transmitted.
Very basic command for ssh :
ssh username@hostname
username : The name with which the user has created the account in the remote system.
Note – To know the username of your system, use the UNIX command “whoami”.
hostname : It’s the remote system’s IP address or its name.
Note – To know the hostname of your system, use the UNIX command “hostname”.
Let’s start off with an example (I have used a dummy username and IP address in the following example)-
ssh abc@123.122.121.120
Before actually connecting to the system, you will be asked the following
The authenticity of host '123.122.121.120 (123.122.121.120)' can't be established.
ECDSA key fingerprint is SHA256:Ub/Y0zpHQZMbD2tzcS75U/IVdA/jh6U/qSZal/LbxUw.
Are you sure you want to continue connecting (yes/no)?
By this step, host is validated. That means if you are logging into the system for the first time and you are sure this system is authentic, it is assigned an unique key and the information is stored in the following path –
~/.ssh/known_hosts
Why this step is important? Because SSH wants to make sure that you are connecting to the system which you think you are connecting to. If, later at some point of time, the hackers tries to trick you into logging into their spoofed machines to sniff your SSH session, it will throw a warning saying that the DNS spoofing is happening and it will not connect to that system.
Now, say yes to that first time question. It will ask for the remote system’s password, if there is any. Now, you have terminal access to your remote system.
If you are using a Mac system, you have to first enable remote sessions in Mac’s security settings. For that, do the following
Command+Space_Bar-->Type "Security Preference"-->Go to "Sharing"-->Check "Remote Login" option
Do the same with the remote system, if it is also Mac.
To end the remote sessions, use UNIX command “exit”.