I’m currently away from home, and I would like to access my iMac which is turned on in my place. I set up the mac screen sharing before I leave, but something went wrong, and I can’t access it from my MacBook.
My home network is accessible via ssh on a Raspberry Pi. I would like to know, if there is any way to access my iMac and set up a ftp or vnc server on this one via the RPI.
For example, is there any linux software that could allow me to acces another client on the same network via VNC. If it’s possible, then I could try to access the RPI from my current place.
EDIT: After @baf comment, here are all my open ports on the iMac:
PORT STATE SERVICE 3/tcp filtered compressnet 22/tcp open ssh 88/tcp open kerberos-sec 222/tcp filtered rsh-spx 513/tcp filtered login 898/tcp filtered sun-manageconsole 1055/tcp filtered ansyslmd 1083/tcp filtered ansoft-lm-1 1455/tcp filtered esl-lm 2725/tcp filtered msolap-ptp2 3370/tcp filtered satvid-datalnk 3801/tcp filtered ibm-mgr 5900/tcp open vnc 8873/tcp filtered dxspider 9001/tcp filtered tor-orport 9110/tcp filtered unknown 10628/tcp filtered unknown 13782/tcp filtered netbackup 20221/tcp filtered unknown 31038/tcp filtered unknown 32772/tcp filtered sometimes-rpc7 32776/tcp filtered sometimes-rpc15 40911/tcp filtered unknown 44176/tcp filtered unknown
EDIT: After baf answer, I update what I currently did:
I execute that command:
ssh -L 5999:192.168.1.10:5900 pi_host_over_internet So if I understand correctly the VNC port from my iMac is accessible throught the port 5999 from my Pi. Now to connect to it from my current location, I need to connect with a VNC client to ‘pi_host_over_internet:5999’. I try this, but obviously, it doesn’t work because the port 5999 isn’t forwarded to the Pi on his router.
EDIT: Clarifying my setup:
What I have right now, where I am (UK):
MacBook connected to a public WiFi
What I have in my home (France):
Imac, local ip:`22.214.171.124`, port 5900 listenin to VNC, port 22 listening to SSH RPI, local ip:`192.168.1.12`, port 22 listening to SSH router accessible at `mydomain.com`, port 22 forwarded to RPI@`192,168.1.12:22`
EDIT: Here is what I get after @baf answer:
I would take any suggestion, so feel free to propose anything.
On you local machine (outside your network) you should run ssh client with following parameters:
ssh -L 5999:imac_host:5900 pi_host
I chose 5999 for local port but it could be any port. You only have to make sure it is not used by any local service. Substitute
pi_host with ip addresses.
When you successfully connect with given command,
vnc port 5900 from
imac_host will be forwarded to your local machine port 5999.
Next you need to configure your vnc client on your local machine to connect to
localhost at port
5999 (connect to itself at given port).
How it works
VNC server on you iMac is listening on port
5900 for incoming connections.
VNC clients may connect to this port from other machines in your local network. As you don’t have direct access to port
5900 on your iMac, you are using
ssh to tunnel the connection from your computer over Internet through the router to iMac in your local network.
ssh opens port
5999 (could be any other port) on your current machine and listens on this port for connections. When you connect to this port
ssh tunnels the connection (through ssh port
22) to your router and from the router establishes connection to iMac on port
5900. It is called port forwarding.
Your iMac also has ssh enabled. If you don’t need vnc, but only want to copy a file, it should be possible to use scp. To make it simple you could try without any port forwarding. Just copy file from
pi_host. From Pi console run:
scp username@imac_host:path_to_file destination_file`
This will copy
path_to_file file to
destination_file in your current folder on Pi. Then you can repeat this step and copy file from Pi to your local machine.