I was experimenting with linux ssh. And in terminal I tried to connect with the same linux machine which I was using and it got connected! Its like calling your same phone from your phone! But how this is possible?
Below is sample terminal commands I entered:
alpha@alpha:~$ ssh alpha@<my IP address>
alpha@<my IP address>'s password: <my password>
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-42-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
* Canonical Livepatch is available for installation.
- Reduce system reboots and improve kernel security. Activate at:
https://ubuntu.com/livepatch
0 packages can be updated.
0 updates are security updates.
Last login: Mon Dec 10 15:31:35 2018 from <my IP address>
In above terminal is the same IP address of the linux machine by which I used ssh and the above terminal output. And I have also noticed that I can connect with the same machine using ssh in nested connections and I have tried 5 level deep!
Out of curiosity I am asking this question to know is this correct? Can't the linux detect its talking to itself?
openssh-serverandopenssh-client.ssh <user>@localhost. The result is the same if you use ssh <user>@<my IP address>. In this way you obtain to have a shell inside the shell that called ssh.sshdthat will only listen onlocalhost, or one that only listens to the public IP address; and it's possible for the firewall to treat the two differently.