Running a remote instance of Firefox over an SSH tunnel (BASH)

Just occasionally I need to briefly run Firefox over an SSH connection, normally because I need something that's stored in Firefox on another machine (like a password that went into FF's manager by accident, or a bookmark - though those are easier dealt with another way)

This isn't something you want to do routinely, unless the remote end has very good upload speeds (even then, the repaints will be painful) and is only really viable as a means of last resort.

Simply creating a tunnel and running firefox won't work though, as by default Firefox will check for and connect to any existing instances, so you'll effectively just get a new firefox window on your local machine with no access to the data you're trying to access.

To avoid this, you need to use Firefox's no-remote argument.

Details

  • Language: BASH

Snippet

# Create the SSH tunnel
ssh -X [remote host]

# Run Firefox from within the SSH session
firefox -no-remote