Differences

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

integration_putty 2020-02-07 integration_putty 2024-03-19 (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. //In the latest beta version,// you can configure all PuTTY settings on [[ui_login_environment|//Environment// page]] of Advanced Site Settings dialog. &beta +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 +
-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 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]]. 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]].
Line 43: Line 39:
<code custom-command-local> <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 custom-command-local> <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 80: Line 76:
===== [[openssh]] Using OpenSSH Instead of PuTTY ===== ===== [[openssh]] Using OpenSSH Instead of PuTTY =====
-==== Win32-OpenSSH ====+==== [[win32-openssh]] Win32-OpenSSH ====
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]]. 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]].
Line 95: Line 91:
<code custom-command-local> <code custom-command-local>
-%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !# -t "cd !/ ; /bin/bash"+%SystemRoot%\Sysnative\OpenSSH\ssh.exe !U@!@ -p !# -t "cd !/ ; /bin/bash --login"
</code> </code>
(assuming a Unix-like system and the ''bash'' shell) (assuming a Unix-like system and the ''bash'' shell)
-==== WSL ====+==== [[wt]] Win32-OpenSSH in Windows Terminal ====
-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 "Bash on Ubuntu on Windows".)) instead of PuTTY, you need to configure the following command [[ui_pref_integration_app|preferences]]: &winpath &win64+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> <code custom-command-local>
Line 108: Line 115:
</code> </code>
-Also, make sure that [[ui_pref_integration_app#other_options|//Remember session password and pass it to PuTTY//]] is turned off.+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]]: 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> <code custom-command-local>
-"%SystemRoot%\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>

Last modified: by martin