Packaging SSH Clients: PuttyTray redux and FileZilla
SSH has many implementations mainly due to it being an Internet Engineering Task Force (IETF) standardized protocol. One motivating force for this packaging effort was the need to interact with UTF-8 charset enabled systems, recognizable typically from their latin-1 alphabet interpretations where åäö become åäö.
Putty
From various comparisons, Putty fared quite well as a free and functional SSH client. Being an open source program, it has gotten some forks which implement support for URL-clicking from the terminal. Nutty and PuTTY Tray have ceased development, but PuTTY Tray Redux has recently published a version with the same functionality.
Putty is in itself a pretty simple program. Just one executable file, no installer, settings are stored in the HKEY_CURRENT_USER registry and the program doesn't need administrative priviledges to install or run. There are also portable putty versions that store the settings in files.
Here's a modifiable install.bat file we used:
REM 2011-08-15 JoniN/CSC REM This will install PuttyTray Redux, which has URL-click support added to Putty. REM The script needs to be run with admin-level rights to modify the %ProgramFiles% folder REM Version downloaded from http://www.simmonsconsulting.com/2011/07/30/puttytray-redux/ REM Map server share echo ohi | net use * \\server\share /user:put\ty redux /PERSISTENT:NO REM Remove possible older versions IF EXIST "%ProgramFiles%\Putty" RMDIR "%ProgramFiles%\Putty" /S /Q REM Install PuttyTray Redux 0.61 MKDIR "%ProgramFiles%\Putty" COPY /Y \\server\share\folder\Putty\puttyTray.exe "%ProgramFiles%\Putty" REM Making of the shortcut and copying it to the start menu MKDIR C:\Temp CACLS C:\Temp /E /G USERS:F DEL /F /Q C:\Temp\PuttyTray.LNK CSCRIPT \\server\share\folder\Putty\puttyIcon.vbs COPY C:\Temp\PuttyTray.LNK "%AllUsersProfile%\Desktop\PuttyTray.LNK" MKDIR "%AllUsersProfile%\Start Menu\Programs\SSH" COPY C:\Temp\PuttyTray.LNK "%AllUsersProfile%\Start Menu\Programs\SSH" DEL /F /Q C:\Temp\PuttyTray.LNK
To assist the creation of icons, this puttyIcon.vbs script was included in the installation folder:
Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = "C:\temp\PuttyTray.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)
oLink.TargetPath = "%ProgramFiles%\Putty\PuttyTray.EXE"
' oLink.Arguments = ""
oLink.Description = "SSH Client"
' oLink.HotKey = "ALT+CTRL+F"
' oLink.IconLocation = "C:\Program Files\MyApp\MyProgram.EXE, 2"
' oLink.WindowStyle = "1"
' oLink.WorkingDirectory = "C:\Program Files\MyApp"
oLink.Save
The slinkfile parameter didn't support environmental variables, so a fixed path was used to generate the initial icon into. By using the same %ProgramFiles% variable in both the copying part and the icon part, it will work in all windows systems, XP and windows 7 included.
Since the default charset in Putty is ISO-8859-1 (Latin-1), we needed to change the default. This was done by adding this piece of script to a script that is run everytime a user logs on to a domain:
REM ************ Putty settings start ************* REM Setting default charset to UTF-8 once / user account REM This means that the user can also change the default if (s)he so wishes REM The log file is %SystemRoot%\OwnLogs\PuttyDef.txt REM 2011-08-18 JoniN/CSC :logsCreated rem Is the log directory created by admin-level scripts already? if not exist "%SystemRoot%\OwnLogs" goto end set LOGFOLD=%SystemRoot%\OwnLogs rem Checking if the software has been installed already, using local resources rem Check is also user-specific type %LOGFOLD%\PuttyDef.txt | %SystemRoot%\system32\qgrep -z -y %username% if ERRORLEVEL==1 goto install rem ERRORLEVEL will match 1 or greater if the file is not found or username is not found goto end :install IF NOT EXIST "%ProgramFiles%\Putty\PuttyTray.exe" goto end %SystemRoot%\regedit /s \\ad.domain.here\SYSVOL\ad.domain.here\settings\Putty\Putty-default-UTF8.reg IF NOT EXIST "%LOGFOLD%\PuttyDef.txt" echo Putty default charset has been set to UTF-8 for these users: > "%LOGFOLD%\PuttyDef.txt" echo "%username% %date%" >> "%LOGFOLD%\PuttyDef.txt" :end REM ************ Putty settings end *************
The script uses qgrep which can be obtained from the Windows server 2003 resource kit. The associated Putty-default-UTF8.reg file is here:
Windows Registry Editor Version 5.00 [HKCU\Software\SimonTatham\PuTTY\Sessions\Default%20Settings] "LineCodePage"="UTF-8"
If Putty needs to be removed, I also made this uninstall.bat script to revert changes:
REM 2011-08-17 JoniN/CSC REM This will remove PuttyTray Redux CSC-packaged version REM The script needs to be run with admin-level rights in order to modify the %ProgramFiles% folder REM Remove possible old version IF EXIST "%ProgramFiles%\Putty" RMDIR "%ProgramFiles%\Putty" /S /Q DEL /F /Q C:\Temp\PuttyTray.LNK DEL /F /Q "%AllUsersProfile%\Desktop\PuttyTray.LNK" DEL /F /Q "%AllUsersProfile%\Start Menu\Programs\SSH\PuttyTray.LNK" RMDIR "%AllUsersProfile%\Start Menu\Programs\SSH"
FileZilla
To get a graphical client for transferring files, we could have used the Firefox FireFTP plugin. We opted for FileZilla because it has slightly wider protocol support and the transfers are processor-efficient, achieving high throughput. Also the fact that it's available on three major platforms (Win, Linux, Mac) makes the user experience worthy of learning for continued use.
The installation process is pretty simple. Download the installer and use the /S switch to do a silent install with default settings.
Since FileZilla updates quite often, we don't want to burden our users with frequent updates. Disabling the update checks was done by copying this fzdefaults.xml file to the installation directory:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<FileZilla3>
<Settings>
<Setting name="Disable update check">1</Setting>
</Settings>
</FileZilla3>
And here's the related install.bat:
REM 2011-08-16 JoniN/CSC REM FileZilla is an FTP,SFTP ja FTPS client, that is quite easy to use and efficient in transfers. REM http://www.appdeploy.com/packages/detail.asp?id=1399 REM Map server share echo ohi | net use * \\server\share /user:fil\ezi lla /PERSISTENT:NO REM Install of FileZilla \\server\share\FileZilla\FileZilla_3.5.0_win32-setup.exe /S REM Remove automatic updates IF DEFINED ProgramFiles(x86) GOTO W7 COPY /Y \\server\share\FileZilla\fzdefaults.xml "%ProgramFiles%\FileZilla FTP Client" GOTO END :W7 COPY /Y \\server\share\FileZilla\fzdefaults.xml "%ProgramFiles(x86)%\FileZilla FTP Client" :END REM The installer engine is Nullsoft installer 2.0: REM http://unattended.sourceforge.net/installers.php
Here we assume that all Windows 7 installations are 64bit versions, making FileZilla install into the %ProgramFiles(x86)% directory.
PS: FileZilla and other tools can also be installed and updated with the simple Ninite tool.
LvvWOKysMaDw