RISE to Bloome Software
Log In    
r2bsoftware.se r2bsoftware.se
Click to hide navigation tree

Marshal SSH using PuTTY

This is a utility to access a remote file system using SSH (Secure SHell). The utility consists of two parts: a GUI application user and a reusable assembly for software development.

Marshal SSHPuTTY is a free software, you can download it here!

How to use the GUI

The client application is launched through the start menu (RISE To Bloome Software | Marshal | Marshal SSH Client). Once connected to a remote host, it allows the user to:
  • Browse the remote host folder structure.
  • Upload files and folders from the local computer to the remote host.
  • Download files and folders from the remote host to the local computer.
  • Rename folders and files on the remote host.
  • Delete folders and files on the remote host.
  • Create new, empty, folders on the remote host.
The GUI is primarily used by right-clicking in the folder structure and then chosing a function from the popup menu. It also supports drag-and-drop as well as copy-paste from the local computer onto the remote host.

Before you can start using the application you need to provide information on how to connect to the remote host. This includes providing the IP address of the remote host, a username to use on the remote host and a directory whereto start. 

You should also provide a private key file for authentication. The remote host system administrator should be able to provide you with this file. In case you're doing all the work yourself, see this guide from the author of PuTTY. If you skip the private key file, you'll be prompted for a password when connecting to the remote host.   

You don't have to provide these settings every time. You may save them to, and load them from, a configuration file. Once all settings are in place, press  to connect to the remote host. If everything is fine, the contents of the remote host root folder is displayed in the bottom tree!

Loaded folders are displayed with a  and files with  or  for XML files having the same name as the folder they're in. The application uses lazy loading. This means the contents of a folder will unknown until you access the folder. Folders yet to be loaded are grayed out using .

Now you're ready to start working with file on the remote host!

How to use the SDK

Marshal SSH simply adds programmability for file transfer purposes to the PuTTY SSH client. 

In the installation (eg C:\Program Files (x86)\RISE to Bloome Software\Marshal SSH Client) you'll find an assembly, SSHPuTTY.dll, and two the PuTTY executables plink.exe and pscp.exe. To start developing, add (copy) these components into your Visual Studio development project and add a reference to the assembly.

The namespace of interest is SSHPuTTY. In particular, it contains the classes PLINK, PSCP and Configuration. 
  1. Create an instance of Configuration and set its properties. These correspond to the settings of the GUI above.
  2. To operate on the remote file system (list, delete, rename), create an instance of PLINK and call the appropriate method.
  3. To download or upload files and folders, create an instance of PSCP and call the appropriate method.
The below example should display a full listing of the host root folder in console application:
SSHPuTTY.Configuration conf = new SSHPuTTY.Configuration()
   host = "",
   ppk = "id_rsa.ppk",
   user = "scott"
new SSHPuTTY.PLINK(conf).ListDirectory("/home/scott").ForEach(delegate(SSHPuTTY.PLINK.RemoteHostFile file)

All methods operating on the remote host file system require a remote path. This path should always be absolute!

PLINK.ListDirectory is the only method returning any data; a list of PLINK.RemoteHostFile objects. The properties of RemoteHostFile include the columns returned by the Unix command "ls -la". Note, since we're listing all directory items the list will include "." and "..", representing the current directory and its parent directory. RemoteHostFile also includes the property parent. This is the value passed to ListDirectory, ie it's the remote path of the directory that was listed.

If an error occurs, it's reported by setting the Success and ErrorMessage properties of the PLINK/PSCP object. 

The first time PuTTY connects to a remote host using SSH, it requires user verification of the host key. This is a precaution to avoid spoofing. Run PuTTY manually, for instance using the Marshal SSH GUI, and accept the host key (provided it's okay, of course) before running your own SSH application. You may also add the verification process to your own software using the PLINK methods UnknownHost and AcceptHostKey.