How to use ssh to run a local command after connection and quit after this local command is executed?

Viewed 4059

I wish to use SSH to establish a temporary port forward, run a local command and then quit, closing the ssh connection.

The command has to be run locally, not on the remote site.

For example consider a server in a DMZ and you need to allow an application from your machine to connect to port 8080, but you have only SSH access.

How can this be done?

2 Answers
Related