Open server browser in local browser
When I ssh into my server and do my things there. How can I for example open a browser on the remote machine, and display it on my local machine,
I run Ubuntu desktop on my local machine. On server side I use Ubuntu 16.04 server. Its a development server so I have a python script there that use:
webbrowser.open("https://" + url)
to open default browser with the URL I need.
In other words how can I when I'm logged into the server, open a link on my local machine.
In more general words, how can I use my Ubuntu remote server machine as if its my local machine?
Since:
- A serverside machine doesn't NEED a GUI.
- I don't want to install a server GUI and use REMOTE DESKTOP.
How can I access my own development server and open a simple program on my local machine?
Solution 1:
The easy way to do this, is to use SSH's socks proxy. From the man page:
-D [bind_address:]port
Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine.
Browsers can also use socks proxy. How to configure it depends on which browser you happen to use, but I typically use one browser for work over socks, and another for non-proxied work.
First, start ssh with the following command:
ssh -D1080 [email protected]
This will run ssh, creating a socks proxy to the remote host, listening on port 1080. In your browser, enter a socks proxy on localhost, port 1080. In Firefox this is located under Preferences - Advanced - Network:
This will tunnel traffic from the browser to the remote machine, and traffic will appear to be sourced from the remote machine.
Solution 2:
First, in your server sshd_config, enable X11 forwarding as follow
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
Then ssh in your server:
$ ssh user@server -C -X
Then launch firefox
$ firefox