Use real browser instead of w3m on SSH connections

Use ssh port forwarding.

Connect to the remote server with something like this:

ssh -L 8080:localhost:80 user@remoteserver

Now, point your local browser to localhost:8080. It should be forwarded to localhost:80 in the remote server.


PART 1

Make a socks proxy with ssh!

ssh -D 9999 user@remoteserver

Now open your Firefox preferences, go to Advanced > Network > Settings. Select Manual proxy configuration. Put localhost for the SOCKS Host, put 9999 for the port. Test it by going to http://whatismyip.org or some similar site.

Because you said you're trying to access a web page at localhost (relative to your server), you may not want to exclude localhost and 127.0.0.1 from using the proxy. Of course, you could just use the local ip of the server..

If you don't like my explanation, these links jogged my memory while writing this:

http://linux.die.net/man/1/ssh

http://embraceubuntu.com/2006/12/08/ssh-tunnel-socks-proxy-forwarding-secure-browsing/

https://calomel.org/firefox_ssh_proxy.html

PART 2

The error you got, channel 3: open failed: connect failed: Connection refused has absolutely nothing to do with ssh. Apparently you're trying to access some mysql thing. This has an extra challenge, because mysql blocks access from ssh tunnels by default. I don't do mysql, so I don't know what I'm talking about for the rest of this. I'm just quoting the relevant bits of the link at the end, which you should read.

Open /etc/mysql/my.cnf and look for the [mysqld] section. If you see a line "skip-networking", comment it. Add "bind-address = 127.0.0.1" (without the quotes, of course).

http://www.debuntu.org/port-forwarding-and-channel-3-open-failed-connect-failed-Connection-refused

Part 3

Javier's solution ssh -L 8080:localhost:80 user@remoteserver is fantastic if you just need access to the one location. It lets you access localhost, and leaves the rest of your internet alone. My solution with ssh -D goes farther, and will actually direct all of your http requests to the remote server. Obviously you might not actually want this. But I've found it useful when I wanted http access to all machines on a network, or when I didn't want my http requests going through the network I'm wired into (ie, online banking at starbucks. All my traffic goes through the ssh tunnel to my home internet.)


You can use X forwarding through SSH so that any X applications that you run on the server would show up on your personal computer.

  1. When connecting with SSH to the server, add the -X flag. For example, ssh -X myserver.
  2. Install a GUI browser on the server and simply run it. The output will appear on your personal computer through X forwarding and the secure SSH connection.