Every tutorial I watched displayed how to connect two machines via ssh locally. But what if I want remote control via internet?
I know that IP addresses which start with 192.168 are local and invisible to internet users(of corse, 255*255 = about 65k ip adresses wouldn't be enough for millions internet devices on such big network), so I needed to know my public IP and I found it out by typing
curl icanhazip.com
in terminal. Also, I know that port 22 is default for ssh protocol and my firewall, exactly both firewalls on machines are disabled. Both machines use Ubuntu 16.04. On one, which i chosen to be the server, I created .ssh directory in home folder (with permission 700) and file "authorized_users"(with permission 600) inside it. I checked
service sshd status
and restarted it, so it was being active. I (exactly my bro, which is intended to be remote user of my comp i.e. server) generated public and private key by:
ssh-keygen -t dsa
and created id_dsa and id_dsa.pub files on remote machine(not on server). After that, I sent him my public IP(because we want ssh communication via internet, I can't see another network) and he typed:
ssh-copy-id servername@serverPublicIP
But, it did not create anything in my /home/pc/.ssh/authorized_users, and of corse after trying to connect by
ssh servername@serverPublicIP
it didn't succeed.
0 Answers