logo
Have fun, but in security with OpenSSH
X11 forwarding
Watch a remote webcam
Run GUI programs on the ssh server
Display a movie on the server
Access to a website through ssh (port forwarding)
Create socks proxy with OpenSSH

Have fun, but in security with OpenSSH

X11 forwarding

It is possible to display on the ssh client (local computer) GUI applications run by the ssh server (remote computer). To do this, use the following command:
ssh -Y remote_user@ssh_server
It is now possible to launch a GUI process that will be displayed on the client screen. For example:
xmessage 'hello world'
Warning, for security reasons, it is recommended to use the -Y instead of -X even if it seems to have a similar behavior cf: man ssh for more infosmations.

Watch a remote webcam

Now that we have enabled X11 forwarding, it is possible to view a webcam on the ssh server with the following command:
ssh -Y remote_user@ssh_server
mplayer tv:// -tv driver=v4l2:device=/dev/video0:width=320:height=240

Run GUI programs on the ssh server

It is sometimes useful to run graphical applications remotely to start a movie on your desktop from your laptop, for example. To do this simply log on and specify that the screen you want to use is the server's as follows:
ssh remote_user@ssh_server
export DISPLAY=:0.0

Display a movie on the server

Now that we launched programs on the screen of the ssh server, if you want to see a movie that is on it, there is one small thing left to do:
mplayer /path/movie.avi

Access to a website through ssh (port forwarding)

To access a website that is inaccessible from the client but can be accessed from the server (eg a box or other local site) you should enter the following command:
ssh -L 2080:theInaccessibleUrl.net:80 remote_user@ssh_server
Now you can browse with your favorite web browser to the following url: http://localhost:2080/ and voila.

Create socks proxy with OpenSSH

It is possible to create a SOCKS5 proxy with OpenSSH. Simply enter the following command:
ssh -D localhost:8080 remote_user@ssh_server
You now have a SOCKS proxy on port 8080 of the client. In Firefox for example, you have to configure the proxy manually and then put all the fields blank except SOCKS which will be your loopback address (127.0.0.1) if you are on the ssh client else the client's ip and port 8080.
Be The First To Comment.

Add a comment:





You can use these HTML tags: <br><a><i><b>