How to access internet on my firefox through ssh remote?

2

1

Alright, I'm completely blank into this weird world.

Let's say, I can access a ssh remote server(A server which has no GUI and no monitor but have internet connection) using terminal in ubuntu(Which is my PC with GUI). I just don't have Internet connection on my PC but could access server's internet(Which has no GUI and no monitor) using Elink text based browser only in terminal.

I could also save any file onto that ssh remote server using wget command into terminal. It doesn't save file into my hard drive because i'm accessing another server(Which has no GUI).

But my wish is to access that server's(Which has no GUI) Internet onto my firefox. I'm getting stuck with elink's browser(A text based shi* browser). Kindly let me know, Is it possible to access that internet on my Firefox?

Help surely would be appreciated!!

Smarter way

Posted 2015-09-13T11:45:12.173

Reputation: 21

Answers

1

You can achieve it with SOCKS proxy. Use -D option With OpenSSH ssh client:

ssh -fND 12000 <REMOTE_IP>

It will create a local SOCKS proxy on port 12000, you can choose another port if you wish. -fN is to put ssh command in background as all we want to do is just to create SOCKS proxy. In firefox go to Edit->Preferences->Advanced->Network->Settings, check Manual proxy configuration, put localhost in SOCKS host and put 12000 in Port next to it. From now you should be able to access Internet in firefox via the remote host. This a classical form of tunneling. It's especially useful for circumventing over-eager firewalls or for secure connections in internet cafes etc. If you feel you will it more often you can automate the whole process in Firefox using mozrepl addon. For example, I use the following script:

#!/usr/bin/env sh

ssh -4 -fND 12000 home

# modify firefox settings with mozrepl

(echo "prefs = Components.classes[\"@mozilla.org/preferences-service;1\"].getService(Components.interfaces.nsIPrefBranch)"; echo "prefs.setIntPref(\"network.proxy.type\", \"1\")"; sleep 2) | telnet 127.0.0.1 4242 > /dev/null

# got to http://v4.ident.me/ to make sure that IP changed
(echo "content.location.href = 'http://v4.ident.me/'"; sleep 2) | telnet 127.0.0.1 4242 > /dev/null

Also note that you can use your locally created SOCKS proxy in many other programs such as e-mail clients that do not support SOCKS proxy out of the box using tsocks wrapper.

Arkadiusz Drabczyk

Posted 2015-09-13T11:45:12.173

Reputation: 1 776

Suppose i'm able to connect my server on termianl using ssh -a aroraarora.. Then how would i connect it? – Smarter way – 2015-09-14T13:29:54.553

I'm not sure what you're asking. As I said: ssh -fND 12000 aroraarora. Add -a if you need it. – Arkadiusz Drabczyk – 2015-09-14T13:31:14.427

Suppose, I do connect my server using rhc let's say.. rhc ssh -a aroraarora.. then how would i connect it with firefox? – Smarter way – 2015-09-14T13:35:47.557

I have never heard about rhc. You only asked about ssh. Does ssh method work for you? If this rhc tool is a wrapper for ssh it also might work. – Arkadiusz Drabczyk – 2015-09-14T13:38:35.307

Okay dude.. Let me try first, I'd get back to accept your answer once it gets connected. – Smarter way – 2015-09-14T13:40:13.710