Skip to main content
2 of 3
added 128 characters in body; edited title
sam wolfe
  • 5k
  • 11
  • 45

How to access an password-protected ssh server using PowerShell in Mathematica?

I want to run Windows PowerShell commands via Mathematica. Specifically, I need to access a ssh server which is password-protected. When I do this using the PowerShell, I get the following prompt

enter image description here

where I can then type my password. However, while using RunProcess in Mathematica, I do not get any password requests and the evaluation does not end. Any way around this?

Here is my code, which works for any other PowerShell commands, inspired by this post,

shell[s_] := RunProcess[{"powershell", s}, "StandardOutput"]
shell["ssh [user]@[domain]"]

for which the second evaluation does not end. How can I overcome this, somehow introducing the password, and access the server? I am also aware of this question, but it does not really help me. Any ideas?

Update: The server has now imposed a Multi-Factor Authentication (MFA) process for which I need to introduce an OTP (following the password), adding to the problem. However, I think a solution to the first issue might potentially also fix this. Any ideas?

sam wolfe
  • 5k
  • 11
  • 45