0

I have a simple media player computer running Debian 10. It is located in a museum, where it continually plays a video file for an art installation (using mpv). The computer is connected to the museum's WiFi network.

Sometimes, the museum emails me a new video file to play. I then proceed to copy the video file to a USB flash drive, travel to the museum, attach a keyboard to the computer, and copy over the file.

When I'm at home I would like to upload a file to the computer in the museum. I can't use scp because while the computer is connected to the internet, it has no public hostname/ip address.

How can I do this?

2
  • Am I missing something? What is reverse about it? Oct 25, 2020 at 22:22
  • Let me clarify: when I'm at home I would like to upload a file to the computer in the museum. I can't use scp because the computer has no public hostname/ip address. That's why I thought I needed a "reverse" shell. Oct 25, 2020 at 22:53

3 Answers 3

2

If I read the question, including the title properly, you are asking how connect from the museum computer to your computer so you can copy a video up.

This is known as "reverse ssh tunneling", and basically what you do is on the museum computer you run a ssh -R command that causes a tunnel to get set up from inside their firewall to your computer. Then you ssh/scp from your computer to the port that is established by the tunneling command. Yeah, it can get confusing the first 100 or so times you do it.

Some literature: https://www.howtogeek.com/428413/what-is-reverse-ssh-tunneling-and-how-to-use-it/ https://www.howtoforge.com/reverse-ssh-tunneling

The problem is that you either have to:

  1. Leave the tunnel up all the time (meaning have some sort of script that restarts it)
  2. Have some mechanism of triggering the creation of the tunnel.
  3. Have the tunnel on a "timer" (say connects every day at 8 PM.

An example of Number 2 would be to have the tunnel created whenever someone sticks a USB device into the machine. Then instead of emailing you the video, the museum staff would simply stick it on a USB drive themselves and insert the drive in the computer. You would then have some way of triggering a script that would create the tunnel (bonus points for random ports on the tunnel, communicated to you by the video machine sending an email (more bonus points for encrypting that email) to you that it's ready).

Another solution, channeling the ghost of Reuben Garrett Lucius Goldberg.

Set up an incoming mail server on the video machine. Have the museum staff send the email to "newvideo@machine.whatever.org" Have a script strip off the video from the email and de-encode it back to it's original format. Move the previous video to a backup file. Put the new video in place. Send email to have the museum staff verify that a "good" video is playing.

4
  • Sir, you can have my bonus points if you include the specific ssh -R command in your answer. Oct 25, 2020 at 20:55
  • While the title has the word reverse in it. I see nothing in the use-case, that would need a reverse anything. No need for forward or reverse tunnels, not even a need for a shell. just do a scp. Oct 25, 2020 at 22:24
  • @ctrl-alt-delor: I'm assuming that there is a firewall--usually controlled by some sort of security expert--that won't let him do that. I know that if I was in charge of the museum network security I sure wouldn't have port 22 open to 0.0.0.0/0. I also wouldn't let people ssh out without paperwork including a legit reason.
    – Petro
    Nov 1, 2020 at 16:52
  • @hedgie: I don't know enough about your home network (you probably have a limited firewall on your cable/dsl router that prevents SSH in, you'll have to "fix" that) or the museum's network. There are examples in the URLs I gave that would serve as a base. Sorry I can't be of more help.
    – Petro
    Nov 1, 2020 at 16:55
1

You could set up port forwarding on the router in your museum, so that public port, let's say "2222" takes you to your media player's "22" port. Then you could scp the new file into your media player (you'd connect to the museum's router on port 2222).

The only issue is to know the IP of the router.

1
  • That would work, but I have no access to the museum's router. Also, I assume it's on a residential internet plan without a stable IP address. Oct 25, 2020 at 20:36
0

I don't see anything in your use-case that will need a reverse anything.

If you can not connect in, then you can connect out. Have the machine in the museum, connect to your machine. It could pole for changes, and download if there is a change.

e.g.

Once a day it can ssh to the remote, check the dates, and if a new file is found, then use scp to download it. There are probably tools that can already to this.

You only need a reverse tunnel, if you want to have a general purpose ssh connection to the machine and it can only connect out. As your use case does not call for a general purpose ssh connection, you don't need it.

Alternatives include. Connect to a secure web-site, and download from that. There are even ways that will allow you to connect to a web-site and wait to be informed that the file has changed. (this will eliminate polling, and reduce traffic).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.