Suppose you are connecting to a server using the ssh protocol with the following command:
$ ssh user@server
then you will need:
start the ssh client with the -D порт option, then the ssh program will listen to the specified port on the local computer and (while running) all calls to this port using the socks protocol will be relayed to the server:
$ ssh -D 1122 user@server
the port number here is arbitrary, but, of course, must be greater than 1024 and less than the maximum port number (most likely, it is 65536 on your system), and, of course, should not be used by any other local process.
in the firefox browser on the about:config page, change the following parameters:
network.proxy.type = 1 (0 - disable proxy)network.proxy.socks = 127.0.0.1network.proxy.socks_port = 1122 (the port that you specified above)network.proxy.socks_remote_dns = true (dns requests will also be sent through the tunnel)
The above settings can be made using the "mouse" - on the page "preferences": "advanced" → "network" → "settings".

to disable proxying, it’s enough to change one parameter - network.proxy.type = 0 .
It will probably be convenient enough to have a new profile in firefox with these settings, so that they do not interfere with "normal" work. You can start firefox so that it shows the profile selection dialog, like this:
$ firefox --no-remote -P
you can immediately run the desired profile. for example, if you called the proxy profile:
$ firefox --no-remote -P proxy
most likely, similar settings can be made in other browsers. consult your browser documentation on the use of socks-proxy .