Integration with PuTTY

In addition to being based on source code of this popular SSH client, WinSCP can also share site settings with it.

Advertisement

Importing Sites

To import sites from PuTTY go to Tools > Import Sites on Login dialog.

Opening Session in PuTTY

If WinSCP’s limited ability to execute remote commands does not meet your needs, you can let WinSCP open a shell session in a PuTTY client.

Opening Current Session in PuTTY

To open current session also in PuTTY, go to Commands > Open in PuTTY.

You can also set up WinSCP to Automatically open new sessions in PuTTY.

Opening Session in PuTTY instead of WinSCP

To open session in PuTTY, instead of WinSCP, use Manage > Open in PuTTY command on Login dialog.

PuTTY Session Configuration

By default, WinSCP creates temporary site settings for PuTTY (under the name “WinSCP temporary session”). The site settings will by default contain only the options known by WinSCP, mostly connection options. It will particularly lack any terminal options, so the defaults will apply. To change the defaults, either modify the “Default Settings” profile in PuTTY. Or configure PuTTY settings on Environment page of Advanced Site Settings dialog. Alternatively, you can save PuTTY site settings with the same name as a WinSCP site. WinSCP will then instruct PuTTY to open that session (It will not export any settings, nor connection options).

Advertisement

If WinSCP cannot find the PuTTY executable in the default path (particularly when you are using a derived version of PuTTY) you can specify the path in preferences. Optionally you can also instruct WinSCP to send a session password (if known) to PuTTY. However, a better approach would be to use public key authentication together with Pageant.

Handling ssh:// URL

WinSCP registers to handle ssh:// URL and opens the session specified by the URL in PuTTY.

Opening PuTTY in the Same Directory

If you want PuTTY to open in the same directory as WinSCP, you need to replace its session startup command using -m argument. The syntax of the session startup command would differ with a remote environment, particularly with an operating system and a shell.

For example with a Unix-like system and a bash shell, the command will be like (note the !/ pattern to pass the current remote path):

cd "!/" ; /bin/bash --login

As PuTTY needs the session startup command to be stored in a file, you need to make use of !`command` pattern to store the above command into a temporary file. Also as use of the -m switch implies a non-interactive terminal, you need to force an interactive terminal back using a -t switch.

A complete PuTTY command line for this will be like (change the shell path according to your system and preferences):

"%ProgramFiles%\PuTTY\putty.exe" -t -m "%TEMP%\putty.txt" !`cmd /C echo cd "!/" ; /bin/bash --login > "%TEMP%\putty.txt"`

Download PuTTY

For your convenience you can download PuTTY also from our download page.

Using KiTTY Instead of PuTTY

If you want to use KiTTY, instead of PuTTY, you need to configure path to KiTTY executable in preferences.

When using KiTTY in registry (non-portable) mode, you also need to specify KiTTY registry key in preferences.

When using KiTTY in portable mode, you need to specify patterns !U@!@ -P !# in terminal client path as an alternative way to pass hostname, username and port number to KiTTY. You may also use -title "!N" to pass a session name.

kitty.exe !U@!@ -P !# -title "!N"

To open KiTTY in the same directory as WinSCP, you can use either the same technique as with PuTTY; or use KiTTY’s -cmd switch to avoid use of temporary file:

kitty.exe -cmd "cd '!/'"

Advertisement

Using OpenSSH Instead of PuTTY

Win32-OpenSSH

Windows 10 includes Microsoft build of OpenSSH (Win32-OpenSSH) including the ssh.exe. Win32-OpenSSH can also be manually installed to older versions of Windows.

If you want to use Win32-OpenSSH ssh client from, instead of PuTTY, you need to configure the following command preferences:

%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !#

Also, make sure that Remember session password and pass it to PuTTY is turned off.

You can also have the remote shell open in the same working directory as WinSCP, using a similar trick as with PuTTY:

%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !# -t "cd !/ ; /bin/bash --login"

(assuming a Unix-like system and the bash shell)

Win32-OpenSSH in Windows Terminal

For a better experience, you can execute the ssh in Windows Terminal app:

wt.exe ssh.exe !U@!@ -p !#  -t "cd !/ \; /bin/bash --login"

Note the escaped semicolon.

Adding -w 0 parameter opens a new tab in existing Windows Terminal windows instead of new window.

WSL

If you want to use OpenSSH ssh client in Windows Subsystem for Linux,1 instead of PuTTY, you need to configure the following command preferences:

"%SystemRoot%\Sysnative\bash.exe" -c "ssh !U@!@ -p !#"

Also, make sure that Remember session password and pass it to PuTTY is turned off. Or use sshpass package to allow passing the password on the commandline.

You can also have the remote shell open in the same working directory as WinSCP, using a similar trick as with PuTTY:

"%SystemRoot%\Sysnative\bash.exe" -c "ssh !U@!@ -p !# -t 'cd !/ ; /bin/bash --login'"

(assuming a Unix-like system and the bash shell)

Advertisement

If you want to run the ssh in more advanced console window, you can use for example ConEmu:

"C:\Program Files\ConEmu\ConEmu64.exe" -run bash.exe -c "ssh !U@!@ -p !#"
  1. Also known as “Bash on Ubuntu on Windows”.Back

Last modified: by martin