Differences

This shows you the differences between the selected revisions of the page.

integration_putty 2013-11-18 integration_putty 2024-10-22 (current)
Line 4: Line 4:
===== Importing Sites ===== ===== Importing Sites =====
-To [[ui_import|import sites (stored sessions)]] &beta from PuTTY go to +To [[ui_import|import sites]] from PuTTY go to 
-//[[ui_login_stored_sessions#tools_button|Tools > Import Sites]]// on +//Tools > Import Sites// on [[ui_login|Login dialog]].
-//Sites/Stored sessions page// &beta of Login dialog.+
-===== [[open_putty]] Opening Current Session in PuTTY =====+===== [[open_putty]] Opening Session in PuTTY =====
If WinSCP's limited ability to [[remote_command|execute remote commands]] If WinSCP's limited ability to [[remote_command|execute remote commands]]
-does not meet your needs, you can let WinSCP open a shell session on the +does not meet your needs, you can let WinSCP open a shell session in a PuTTY client.
-same server in a PuTTY client. Go to //Commands > Open in PuTTY//.+
-By default, WinSCP creates temporary site settings for PuTTY (under the name "WinSCP temporary session"). The site settings will contain only the options+==== [[open_putty_current]] 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 //[[ui_pref_integration_app|Automatically open new sessions in PuTTY]]//. 
 + 
 +==== [[open_putty_new]] Opening Session in PuTTY instead of WinSCP ==== 
 + 
 +To open session in PuTTY, instead of WinSCP, use //Manage > Open in PuTTY// command on [[ui_login|Login dialog]]. 
 + 
 +==== [[session_configuration]] 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 known by WinSCP, mostly connection options. It will particularly lack
-any terminal options, so the defaults (//Default Settings// profile) will apply.+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 [[ui_login_environment|//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).
-If you want to configure your own options, you can save PuTTY site settings +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 [[ui_pref_integration_app|preferences]]. Optionally you can also instruct WinSCP to send a session password ([[security_credentials|if known]]) to PuTTY. However, a better approach would be to use [[public key]] authentication together with [[ui_pageant|Pageant]].
-with the same name as a WinSCP site. WinSCP will then instruct PuTTY +
-to open that session (It will not export any settings, nor a connection +
-options).+
-If WinSCP cannot find the PuTTY executable in the default path (particularly when you are using derived version of PuTTY) you can specify the path in [[ui_pref_integration_app|preferences]]. Optionally you can also instruct WinSCP to send a session password ([[security_credentials|if known]]) to PuTTY. However a better approach would be to use [[public key]] authentication together with [[integration_app#pageant|Pageant]].+==== [[url]] Handling ssh:// URL ====
-You can also set up WinSCP to //[[ui_pref_integration_app|Automatically open new sessions in PuTTY]]//.+WinSCP [[integration_url|registers]] to handle ''%%ssh://%%'' URL and opens the session specified by the %%URL%% in PuTTY.
===== [[putty_startup_directory]] Opening PuTTY in the Same Directory ===== ===== [[putty_startup_directory]] 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 the remote environment, particularly with operating system and shell.+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 Unix-like system and ''bash'' shell the command will be like (note the ''!/'' [[ui_pref_integration_app#client_path|pattern]] to pass current remote path):+For example with a Unix-like system and a ''bash'' shell, the command will be like (note the ''!/'' [[ui_pref_integration_app#client_path|pattern]] to pass the current remote path):
-<code> +<code custom-command-local
-cd "!/" ; /bin/bash -login+cd "!/" ; /bin/bash --login
</code> </code>
-As PuTTY needs the session startup command to be stored in a file, you need to make use of ''!`command`'' [[ui_pref_integration_app#client_path|pattern]] to store the above command into a temporary file. Also as use of ''-m'' switch implies a non-interactive terminal, you need to force an interactive terminal back using ''-t'' switch.+As PuTTY needs the session startup command to be stored in a file, you need to make use of ''!`command`'' [[ui_pref_integration_app#client_path|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.
-Complete PuTTY command line for this will be like (change the shell path according to your system and preferences):+A complete [[ui_pref_integration_app|PuTTY command line]] for this will be like (change the shell path according to your system and preferences):
-<code> +<code custom-command-local
-%PROGRAMFILES%\PuTTY\putty.exe -t -m "%TEMP%\putty.txt" !`cmd.exe /c echo cd "!/" ; /bin/bash -login > "%TEMP%\putty.txt"`+"%ProgramFiles%\PuTTY\putty.exe" -t -m "%TEMP%\putty.txt" !`cmd /C echo cd "!/" ; /bin/bash --login > "%TEMP%\putty.txt"`
</code> </code>
-&beta_feature &win32 (* %PROGRAMFILES% resolve to 32 bit folder only as long as WinSCP itself is 32-bit application *)+&win32 (* %ProgramFiles% resolve to 32 bit folder only as long as WinSCP itself is 32-bit application *)
===== Download PuTTY ===== ===== Download PuTTY =====
-For your convenience you can [[&download#putty|download PuTTY]] also from our download page.+For your convenience you can [[&winscp_root/eng/downloads.php#putty|download PuTTY]] also from our download page.
===== [[kitty]] Using KiTTY Instead of PuTTY ===== ===== [[kitty]] Using KiTTY Instead of PuTTY =====
-If you want to use [[http://kitty.9bis.net/|KiTTY]], instead of PuTTY, you need to configure path to KiTTY executable in [[ui_pref_integration_app|preferences]]. +If you want to use [[https://www.9bis.net/kitty/|KiTTY]], instead of PuTTY, you need to configure path to KiTTY executable in [[ui_pref_integration_app|preferences]].
When using KiTTY in registry (non-portable) mode, you also need to specify KiTTY registry key 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 pattern ''!U@!@'' in terminal client path as an alternative way to pass hostname and username to KiTTY:+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.
-<code> +<code custom-command-local
-kitty.exe !U@!@+kitty.exe !U@!@ -P !# -title "!N"
</code> </code>
-To open KiTTY in the same directory as WinSCP, you can use either the same [[integration_app#putty_startup_directory|technique as with PuTTY]]; or use KiTTY's ''[[http://www.9bis.net/kitty/?page=Command-line%20options&amp;zone=en|-cmd]]'' switch to avoid use of temporary file:+To open KiTTY in the same directory as WinSCP, you can use either the same [[#putty_startup_directory|technique as with PuTTY]]; or use KiTTY's [[https://www.9bis.net/kitty/#!pages/CommandLine.md|''-cmd'' switch]] to avoid use of temporary file:
-<code> +<code custom-command-local
-kitty.exe -cmd "cd ""!/""" !U@!@+kitty.exe -cmd "cd '!/'"
</code> </code>
-&amp;beta_feature+===== [[openssh]] Using OpenSSH Instead of PuTTY =====
-===== [[cygwin]] Using Cygwin/OpenSSH Instead of PuTTY =====+==== [[win32-openssh]] Win32-OpenSSH ====
-If you want to use [[http://www.cygwin.com/|Cygwin/OpenSSH]], instead of PuTTY, you need to configure path to Cygwin/OpenSSH executable in [[ui_pref_integration_app|preferences]]. You also need you to specify pattern ''!U@!@'' in arguments to pass hostname and username((This section was inspired by [[http://blog.geekslikeshinythings.com/2013/08/winscp-and-cygwin.html|WinSCP and Cygwin]] article on Geeks Like Shiny Things blog.)):+Windows 10 includes Microsoft build of OpenSSH ([[https://github.com/PowerShell/Win32-OpenSSH|Win32-OpenSSH]]) including the ''ssh.exe''. Win32-OpenSSH can also be manually [[guide_windows_openssh_server|installed to older versions of Windows]].
-&lt;code&gt+If you want to use Win32-OpenSSH ''ssh'' client from, instead of PuTTY, you need to configure the following command [[ui_pref_integration_app|preferences]]: &amp;winpath &amp;win64 
-<path_to_cygwin>\bin\mintty.exe /bin/ssh !U@!@+ 
 +<code custom-command-local> 
 +%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !#
</code> </code>
-where ''&lt;path_to_cygwin&gt;'' is by default ''C:\cygwin'' (32-bit) or ''C:\cygwin64'' (64-bit).+Also, make sure that [[ui_pref_integration_app#other_options|//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 [[integration_putty#putty_startup_directory|similar trick as with PuTTY]]:
 +
 +<code custom-command-local>
 +%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !# -t "cd !/ ; /bin/bash --login"
 +</code>
 +
 +(assuming a Unix-like system and the ''bash'' shell)
 +
 +==== [[wt]] Win32-OpenSSH in Windows Terminal ====
 +
 +For a better experience, you can execute the ''ssh'' in [[https://apps.microsoft.com/detail/9n0dx20hk701|Windows Terminal app]]:
 +<code custom-command-local>
 +wt.exe ssh.exe !U@!@ -p !#  -t "cd !/ \; /bin/bash --login"
 +</code>
 +
 +Note the escaped semicolon.
 +
 +Adding ''-w 0'' parameter opens a new tab in existing Windows Terminal windows instead of new window.
 +
 +==== [[wsl]] WSL ====
 +
 +If you want to use OpenSSH ''ssh'' client in [[https://learn.microsoft.com/en-us/windows/wsl/about|Windows Subsystem for Linux]],((Also known as "Bash on Ubuntu on Windows".)) instead of PuTTY, you need to configure the following command [[ui_pref_integration_app|preferences]]: &winpath &win64
 +
 +<code custom-command-local>
 +"%SystemRoot%\Sysnative\bash.exe" -c "ssh !U@!@ -p !#"
 +</code>
 +
 +Also, make sure that [[ui_pref_integration_app#other_options|//Remember session password and pass it to PuTTY//]] is turned off. Or use [[https://packages.debian.org/buster/sshpass|''sshpass'' package]] to allow passing the password on the command-line.
 +
 +You can also have the remote shell open in the same working directory as WinSCP, using a [[integration_putty#putty_startup_directory|similar trick as with PuTTY]]:
 +
 +<code custom-command-local>
 +"%SystemRoot%\Sysnative\bash.exe" -c "ssh !U@!@ -p !# -t 'cd !/ ; /bin/bash --login'"
 +</code>
 +
 +(assuming a Unix-like system and the ''bash'' shell)
 +
 +If you want to run the ''ssh'' in more advanced console window, you can use for example [[https://conemu.github.io/|ConEmu]]: &winpath &win32 &win64
 +
 +<code custom-command-local>
 +"C:\Program Files\ConEmu\ConEmu64.exe" -run bash.exe -c "ssh !U@!@ -p !#"
 +</code>

Last modified: by martin