Differences

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

integration_putty 2018-01-25 integration_putty 2024-10-22 (current)
Line 23: Line 23:
==== [[session_configuration]] 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 will apply. To change the defaults, modify the //"Default Settings"// profile in PuTTY.+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 session-specific 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 [[ui_pageant|Pageant]].+
==== [[url]] Handling ssh:// URL ==== ==== [[url]] Handling ssh:// URL ====
Line 38: Line 33:
WinSCP [[integration_url|registers]] to handle ''%%ssh://%%'' URL and opens the session specified by the %%URL%% 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 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 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): 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>
Line 58: Line 53:
- ====== 
===== 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 =====
Line 70: Line 64:
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. 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@!@ -P !# -title "!N" kitty.exe !U@!@ -P !# -title "!N"
</code> </code>
-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/?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 '!/'" kitty.exe -cmd "cd '!/'"
</code> </code>
Line 82: Line 76:
===== [[openssh]] Using OpenSSH Instead of PuTTY ===== ===== [[openssh]] Using OpenSSH Instead of PuTTY =====
-If you want to use OpenSSH ''ssh'' client in [[https://docs.microsoft.com/en-us/windows/wsl/about|Windows Subsystem for Linux]],((Also known as &quot;Bash on Ubuntu on Windows".)) instead of PuTTY, you need to configure the following command [[ui_pref_integration_app|preferences]]: &winpath &amp;win64+==== [[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]]. 
-&quot;C:\Windows\Sysnative\bash.exe&quot; -c &quot;ssh !U@!@ -p !#"+ 
 +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&gt; 
 +%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !#
</code> </code>
 +
 +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]]: 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> +<code custom-command-local
-"C:\Windows\Sysnative\bash.exe" -c "ssh !U@!@ -p !# -t 'cd !/ ; /bin/bash'"+"%SystemRoot%\Sysnative\bash.exe" -c "ssh !U@!@ -p !# -t 'cd !/ ; /bin/bash --login'"
</code> </code>
Line 98: Line 127:
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 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>+<code custom-command-local>
"C:\Program Files\ConEmu\ConEmu64.exe" -run bash.exe -c "ssh !U@!@ -p !#" "C:\Program Files\ConEmu\ConEmu64.exe" -run bash.exe -c "ssh !U@!@ -p !#"
</code> </code>

Last modified: by 83.99.159.122