[ISSUE WITH WSL NOT WINDOWS TERMINAL] Pasting from clipboard broken when running ssh-add.exe 2> /dev/null #19320

Closed
opened 2026-01-31 06:40:02 +00:00 by claunia · 3 comments
Owner

Originally created by @OlJohnny on GitHub (Feb 5, 2023).

Windows Terminal version

1.15.3465.0

Windows build number

10.0.19045.0

Other Software

  • WSL2 with Ubuntu (C:\WINDOWS\system32\wsl.exe -d Ubuntu-20.04)
  • ssh-add.exe (OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2)

Steps to reproduce

  • You need to have a passphrase protected ssh key in your windows HOME/.ssh directory (just execute ssh-keygen in a PowerShell Terminal)
  • Start the Windows OpenSSH ssh-agent in an Administrator PowerShell Terminal Start-Service ssh-agent
  • Start WSL2 distribution in Windows Terminal
  • run ssh-add.exe and try to paste your passphrase

Expected Behavior

The passphrase gets pasted (without seeing it) and the key is successfully loaded into the ssh-agent.
This actually works, when running the WSL2 VM by just starting it from the Windows Search (i think it is then running inside cmd.exe) See comments below

Actual Behavior

The passphrase gets pasted so that you can see the text!
Also loading the key then fails, as ssh-add.exe seems to be unable to read the pasted passphrase.
NOTE: this may doesn't happen on the first try, but after running ssh-add -D and ssh-add again, it nearly always happens

Originally created by @OlJohnny on GitHub (Feb 5, 2023). ### Windows Terminal version 1.15.3465.0 ### Windows build number 10.0.19045.0 ### Other Software * WSL2 with Ubuntu (<code>C:\WINDOWS\system32\wsl.exe -d Ubuntu-20.04</code>) * ssh-add.exe (<code>OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2</code>) ### Steps to reproduce * You need to have a passphrase protected ssh key in your windows <code>HOME/.ssh</code> directory (just execute ssh-keygen in a PowerShell Terminal) * Start the Windows OpenSSH ssh-agent in an Administrator PowerShell Terminal <code>Start-Service ssh-agent</code> * Start WSL2 distribution in Windows Terminal * run <code>ssh-add.exe</code> and try to paste your passphrase ### Expected Behavior The passphrase gets pasted (without seeing it) and the key is successfully loaded into the <code>ssh-agent</code>. <s>This actually works, when running the WSL2 VM by just starting it from the Windows Search (i <i>think</i> it is then running inside cmd.exe)</s> See comments below ### Actual Behavior The passphrase gets pasted so that you can see the text! Also loading the key then fails, as ssh-add.exe seems to be unable to read the pasted passphrase. NOTE: this may doesn't happen on the first try, but after running <code>ssh-add -D</code> and <code>ssh-add</code> again, it nearly always happens
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 06:40:02 +00:00
Author
Owner

@OlJohnny commented on GitHub (Feb 5, 2023):

after further testing it seems to be a bug with wsl

@OlJohnny commented on GitHub (Feb 5, 2023): after further testing it seems to be a bug with wsl
Author
Owner

@zadjii-msft commented on GitHub (Feb 5, 2023):

This sounds like a broken interaction with bracketed paste mode. I'd bet you could manually disable bracketed paste mode, before running ssh-add.exe:

printf '\e[?2004l' & ssh-add.exe

(I'm making the assumption that bash/{your shell} wouldn't re-enable it before spawning ssh-add.exe)

OR

I see now that I've typed this up you don't think it's a terminal issue after all.

@zadjii-msft commented on GitHub (Feb 5, 2023): This sounds like a broken interaction with bracketed paste mode. I'd bet you could manually disable bracketed paste mode, before running `ssh-add.exe`: ```printf '\e[?2004l' & ssh-add.exe``` (I'm making the assumption that bash/{your shell} wouldn't re-enable it before spawning `ssh-add.exe`) OR I see now that I've typed this up you don't think it's a terminal issue after all.
Author
Owner

@OlJohnny commented on GitHub (Feb 5, 2023):

I see now that I've typed this up you don't think it's a terminal issue after all.

Seems like it!

I have the culprit, although i don't quite understand why it happens, in a normal bash terminal it doesn't happen

alias asd='ssh-add.exe 2> /dev/null'

Now when running asd, the issue arises again

@OlJohnny commented on GitHub (Feb 5, 2023): > I see now that I've typed this up you don't think it's a terminal issue after all. Seems like it! I have the culprit, although i don't quite understand why it happens, in a normal bash terminal it doesn't happen <code>alias asd='ssh-add.exe 2> /dev/null'</code> Now when running <code>asd</code>, the issue arises again
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19320