2

I have binary data on Linux which I need to transfer to Windows to which I have an ssh access.

The data is stored in pass thus I would prefer not to first store it to a temporary file and then transfer it over scp.

I'm looking for a one liner of the form

pass secrets/cert.pfx | ssh win_pc "??? C:/cert.pfx"

The best I could have done so far is

pass secrets/cert.pfx | ssh win_pc "\$input | Out-File -FilePath c:/cert.pfx"

Which does seem to produce a binary looking c:/private.pfx file, but Windows complains that it is "invalid".

The Windows machine has powershell version 5.1 on it.

1 Answer 1

0

This does the trick

pass secrets/cert.pfx | ssh win_pc "powershell -NoProfile -Command '[Console]::OpenStandardInput().CopyTo([IO.File]::Create(\\\"c:/cert.pfx\\\"))'"

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.