ssh connection between two local computer

9,755

Solution 1

To connect to ssh you need to connect to port 22 on target server. To do so you need:

  1. Ensure that ssh server (openssh-server) is installed and running on Fedora machine.
  2. Find out your target machine external IP address (for example, run curl 'http://icanhazip.com' or open that URL in a browser).
  3. Find out your target server local IP address (for example, using NetworkManager applet, I also strongly recommend making it static to avoid changing router rule every time).
  4. Port forward some port (it has to be higher than 1024, I recommend ports higher than 20000) on your router to your Fedora's local IP and port 22.
  5. Check if port 22 on Fedora is open (run as root iptables -nvL and look into chain INPUT, if it has policy set to ACCEPT - it's open; if policy is DROP, look for rule with dport 22 in that chain, if it's not there - open it, read how iptables function and open the port).
  6. On Ubuntu run telnet $ext_IP $ext_port and see if you get a reply with OpenSSH version and host OS.
  7. If you got a reply - you can connect via ssh user@ext_ip -p ext_port, otherwise there's some kind of misconfiguration (most likely port forwarding is done wrong).

Solution 2

You need two things:

1) Ssh client on the computer you are (A). That is probably already installed on your computer by default (Ubuntu).

2) Ssh server on the other computer (B)

If you have not installed the ssh server it's rather sure missing. Keys are very useful but not mandatory to make the initial connection.

Just type

ssh  192.168.x.y

or whatever destination address you have for "B" and the server will ask your password if everything is ok.

Share:
9,755

Related videos on Youtube

Exodd
Author by

Exodd

Updated on September 18, 2022

Comments

  • Exodd
    Exodd over 1 year

    I'm trying to establish an ssh connection between my personal computers, connected with LAN and Wi-fi to different networks. Let's call them computer A, with Ubuntu 14.04.2 LTS, connected with LAN, and Computer B, with Fedora 20 Heisenbug, connected with Wifi.

    I generated a key on computer A, copied it on a USB, and pasted it into the right file in computer B , but now I don't know how to connect from A to B.

    First of all, do I need to configure B in order to be a host? And then, what is the command I shoul digit to connect? ssh ?@?

    Sorry if it's a total obvious question, but I'm just a newbie in this things. I looked for it in other questions, but I couldn't get the hang of it.

  • Exodd
    Exodd about 9 years
    for point 3, "ip addr show" is the right command, right? And lastly.. a problem on 4.. I don't have any router, B (Fedora) is connected to the web through a mobile phone substituting the router..
  • Gendalph
    Gendalph about 9 years
    If you can connect to your Ubuntu box from Fedora, you could try reverse ssh tunneling, but I've never tried that. Also, a colleague of mine once did set up his Android phone in tethering mode as a bridge (for IP camera), but I don't know the details.