Applications of SSH

From Computing and Software Wiki

Jump to: navigation, search

SSH (Secure Shell) is an encrypted network protocol. It has many useful applications that solve all kinds of communication and security problems.


Secure Shell

The most obvious use for SSH is to allow remote machines to access a shell on the host computer. The host machine must be running an SSH Daemon (sshd) which usually runs on port 22. The remote machine must use an SSH client to connect to the host. On Unix based systems, the command "ssh hostname" will connect to the host specified by hostname with the same username as the user running the command. Alternatively, the user can type "ssh username@hostname" to log in as a different user. In either case, the user will usually be asked to enter the password for the specified user on the host.

File Transfer Using SCP

WinSCP New Screen
WinSCP Interface

SCP is a way to securely copy files. It is a part of the SSH protocol. The SCP command can be invoked at the command line, but there are easier methods. WinSCP provides an easy to use GUI to the SCP file copy protocol.

  1. Download and install WinSCP from here.
  2. Start the program and click "New"
  3. Enter the host, user name and password as well as the type of protocol (SCP in this case).
  4. To save this information to the computer, click Save. Note that this will save the password in an easily recoverable format. A prompt appears asking you if you are sure. Otherwise, for a single Login, just click Login.
  5. The pane on the left is the local computer and the pane on the right is the remote computer.
  6. To copy files from one side to the other, select the files and hit F5 or the Copy button at the bottom of the screen. Alternatively the user can drag/drop files from one pane to the other.

Note: The default interface is the "Norton Commander interface shown here. The interface can be changed to an Explorer-like interface by clicking Options > Preferences > Interface and choosing the Explorer-like radio button. This interface only displays the remote directory and allows the user to drag/drop files similar to how they would in Windows Explorer.

SSH Tunneling

PuTTY Tunnel Settings
Firefox Proxy Settings

One of the many benefits of SSH is that you can create an encrypted tunnel from a port on the client machine to a port on the server machine. This allows the client to access services and daemons on the server that are not exposed to the internet. The traffic is sent to the port of the SSH server, decrypted by the server and then forwarded to the port requested by the client. One useful application of this is providing remote access to a Squid proxy server through Windows.

  1. Set up the squid proxy on the server machine. Make a note of the port that the server is running on. (The default is 3128)
  2. Get PuTTY on the client machine and set up a session with the host.
  3. Go to the Connection > SSH > Tunnels screen in PuTTY.
  4. Add a tunnel from local port 3128 (source port) to port 3128 on the server (destination).
  5. Save these settings and connect to the server.
  6. Set up the proxy in Firefox by going to Tools > Options > Advanced > Network and click on Settings.
  7. Set the radio button to Manual Proxy Configuration and type localhost in the HTTP Proxy field and 3128 in the port.
SSH Tunnel

X11 Forwarding

PuTTY X11 Settings
  1. Set up the SSH server to allow X11 forwarding by making sure the option:
    X11Forwarding yes
    is set in /etc/ssh/sshd_config
  2. Install Xming and PuTTY on the client machine.
  3. Set up Xming to listen on 0.0
  4. Set up PuTTY to forward X11 by going to Connection > SSH > X11, selecting the "Enable X11 Forwarding" checkbox and typing "localhost:0.0" into the "X display location" box.
  5. Connect to the SSH server and test it out by typing "xclock &"

See Also


External Links

  • PuTTY - A free Telnet/SSH client
  • WinSCP - A free SCP/SFTP client for Windows
  • Xming - A free X server for Windows
  • Cygwin - A linux like environment for Windows that contains an SSH package and an X server
  • OpenSSH - Open source implementation of SSH
  • MidpSSH - An SSH client for mobile devices

--Sweenet 19:53, 13 April 2008 (EDT)

Personal tools