Execute commands on a firewalled remote machine using Dropbox

I use dropbox to backup data offsite and sync it between my other computers.
THIS LINK points to a video explaining how dropbox it works.
One of those machines is my personal computer at campus.
It’s behind NAT/firewall so remote access is out of the question.
I figured I could use dropbox to execute commands on it remotely, so I made a bash script for the job.

# Pétur Ingi Egilsson #
for i in `ls $INPUTDIR`;
chmod +x $INPUTDIR$i;
echo $i - `date` >> $OUTPUTFILE;
/bin/bash $INPUTDIR$i >> $OUTPUTFILE;

It executes all the bash scripts uploaded to the /home/petur/Dropbox/petur-laptop/input/ directory, be it a single line or a complex script and redirects the output to the /home/petur/Dropbox/petur-laptop/output file and then deletes the script so it won’t get executed again.
Add the script to crontab and make it run every minute or so.

5 Replies to “Execute commands on a firewalled remote machine using Dropbox”

  1. The machine in question is behind a firewall/NAT, inbound SSH connections are thus impossible.
    I do have SSH access to other servers like “sopo.xyz” for an example.
    I could establish a reverse-SSH session with the firewalled machine by doing the following:
    Execute “ssh -R 12345:localhost:22 user@sopo.xyz” on the firewalled machine, using the dropbox method.
    SSH to user@sopo.xyz and execute “ssh user@localhost -p 12345”.

Leave a Reply