Differences

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

integration_putty 2015-05-05 integration_putty 2024-03-19 (current)
Line 21: Line 21:
To open session in PuTTY, instead of WinSCP, use //Manage > Open in PuTTY// command on [[ui_login|Login dialog]]. To open session in PuTTY, instead of WinSCP, use //Manage > Open in PuTTY// command on [[ui_login|Login dialog]].
-==== PuTTY Session Configuration ====+==== [[session_configuration]] PuTTY Session Configuration ====
-By default, WinSCP creates temporary site settings for PuTTY (under the name "WinSCP temporary session"). The site settings will contain only the options+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 ==== 
 + 
 +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 a remote environment, particularly with an operating system and a 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 an 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):+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 the ''-m'' switch implies a non-interactive terminal, you need to force an interactive terminal back using a ''-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.
-A 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>
-&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 -load "WinSCP temporary session" -cmd "cd ""!/""" !U@!@+kitty.exe -cmd "cd '!/'"
</code> </code>
-===== [[cygwin]] Using Cygwin/OpenSSH Instead of PuTTY =====+===== [[openssh]] Using OpenSSH Instead of PuTTY =====
-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.)):+==== [[win32-openssh]] Win32-OpenSSH ====
-&lt;code&gt+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]]. 
-<path_to_cygwin>\bin\mintty.exe /bin/ssh !U@!@+ 
 +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 
 + 
 +<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 commandline.
 +
 +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 99.224.188.111