SSH V
Tunneling Basics
'Tunneling' in SSH works by 'port forwarding': you establish a connection between a (non-privileged) local port and the port which runs the service to be tunneled on the remote machine (have a look at '/etc/services' for a listing of standard ports). Then you connect to the local port. All requests aimed at the local port are forwarded to the remote port via SSH, and thus encrypted.Tunneling only works if the remote host runs an SSH server, naturally. To check if a remote server runs an SSH server, 'telnet' to port 22 of the remote host:
telnet {full name of remote host} 22
telnet: Unable to connect to remote host: Connection refused
ssh -f {username@remote host} -L {local port}:{full name of remote host}:{remote port} {some command}
Tunneling POP
You can use the Post Office Protocol to get your mail from your mail service provider (e.g. your ISP, university or employer). Tunneling it through SSH should mainly prevent network sniffers from detecting your POP password. As a bonus, you can use SSH's compression mechanism to make mail transfers faster. Say you have got an POP account at pop.foobar.com, your user name is 'bilbo' and your POP-password is 'topsecret'. The command to establish an SSH tunnel then would bessh -f -C bilbo@pop.foobar.com -L 1234:pop.foobar.com:110 sleep 5
bilbo@pop.foobar.com's password:
telnet localhost 1234
Tunneling X
If you want to run X applications off an SSH server on your local machine, log into your remote account, create a file called '/.ssh/environment' and put in this line:XAUTHORITY=/home/{remote user name}/.Xauthority
ssh -f -X -l {remote user name} {remote machine} xterm
Tunneling VNC
VNC allows you to display and control laptops remotely. Passwords are sent unencrypted, which is bad when you want connect to a VNC server via an insecure network like the Internet. The VNC server runs on ports in the 590x range, with x being the number of the display the server runs on. So Windows and Mac Os and Linux VNC servers listen to port 5900, Linux servers then listen to 5901 (second server) or 5902 (third server) etc. Start the VNC server on the remote machine (here a Linux server) and then establish an SSH tunnelssh -C -L 5900:{remote machine}:5901 {remote machine} tail -f /etc/motd
vncviewer localhost:2
vncviewer -encodings "copyrect hextile" localhost:2Tunneling Linuxconf
Linuxconf is a central system configuration tool included in ML. It also allows remote administration. The Linuxconf FAQ says about using Linuxconf via SSH: > >"You can run the GUI locally and Linuxconf remotely. The command line is > >remadmin ––exec {link_command} linuxconf ––guiproto
remadmin ––exec ssh -l {account} linuxconf ––guiproto
Another possibility would be forwarding a non-privileged local port to port 98 of the remote machine, this would allow the use of a web browser for remote administration - with the advantage that the local machine doesn't need to have Linuxconf installed.
Tunneling Webmin
Webmin is a new, browser-based system configuration tool included since ML 7.1. It runs on port 10000. So you have to forward a non-privileged local port to port 10000 of the remote machine, like this:ssh -f -l {remote user name} {remote host} -L 1234:{remote host}:10000 tail -f /etc/motd
http://localhost:1234
Related Resources:
SSH FAQGetting started with SSH
man fetchmail
Secure POP via SSH mini-HOWTO
Remote X Apps mini-HOWTO
'sshvnc.html' in '/usr/doc/vnc-{...}'
Linuxconf FAQ Revision / Modified: Sep. 27, 2001
Author: Tom Berger Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
SSH V
Version 1.7 last modified by imr on 09/11/2006 at 12:31
Version 1.7 last modified by imr on 09/11/2006 at 12:31
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!


