# Windows, Shell, SSH, stdin, and Xojo

**URL:** <https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708>\
**Category:** Windows\
**Created:** [October 7, 2020, 7:43pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708 "2020-10-07T19:43:20Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dana\_Brown](https://forum.xojo.com/user_avatar/forum.xojo.com/dana_brown/32/15210_2.png) [@Dana\_Brown](https://forum.xojo.com/u/Dana_Brown)\
**Post date:** [October 7, 2020, 9:46pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/21 "2020-10-07T21:46:17Z")

</div>

Have you reached out to [Xojo Tech Support](https://www.xojo.com/company/contact.php)?

---

<div class="post-metadata">

**Author:** ![William\_Yu](https://forum.xojo.com/user_avatar/forum.xojo.com/william_yu/32/610_2.png) [@William\_Yu](https://forum.xojo.com/u/William_Yu)\
**Post date:** [October 7, 2020, 10:00pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/22 "2020-10-07T22:00:37Z")

</div>

> [@Tim\_Parnell](#):
>
> Has anyone at Xojo ever been able to use Xojo, Shell, and SSH on Windows?

Have you tried these variations?  
Shell.Execute “powershell.exe ssh test@test…”  
Shell.Execute “cmd.exe /C ssh test@test…”

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [October 7, 2020, 10:34pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/23 "2020-10-07T22:34:00Z")

</div>

> [@Dana\_Brown](#):
>
> Have you reached out to [Xojo Tech Support](https://www.xojo.com/company/contact.php)?

I have not yet, I was hoping I’d missed something simple! I may head down that route tomorrow.

> [@William\_Yu](#):
>
> Have you tried these variations?

I have just tested these to find they both give me the original message of “Pseudo-terminal will not be allocated because stdin is not a terminal.” ☹

---

<div class="post-metadata">

**Author:** ![Andrew\_Paul\_Dickey](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@Andrew\_Paul\_Dickey](https://forum.xojo.com/u/Andrew_Paul_Dickey)\
**Post date:** [October 8, 2020, 12:12am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/24 "2020-10-08T00:12:03Z")

</div>

Tim / William,

I usually pass additional params to ignore user profile and execution policy on Windows - unless I do so - commands won’t execute.

sh.Execute("powershell.exe -NoProfile -ExecutionPolicy Bypass

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [October 8, 2020, 7:00am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/25 "2020-10-08T07:00:17Z")

</div>

If you just need a DataAvailable handler, I could work on that.  
Maybe even an example using it.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [October 8, 2020, 10:44am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/26 "2020-10-08T10:44:21Z")

</div>

I added DataAvailable event and made a GUI example for next release:

 ![SSH Terminal](https://forum.xojo.com/uploads/default/original/2X/0/0c4392be5c656ed26899ffaff500fc8a5c8db7c5.jpeg)

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [October 8, 2020, 11:14am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/27 "2020-10-08T11:14:02Z")

</div>

blog post: [SSH Terminal example for Xojo](https://www.mbs-plugins.de/archive/2020-10-08/SSH_Terminal_example_for_Xojo/monkeybreadsoftware_blog_xojo)

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [October 8, 2020, 11:24am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/28 "2020-10-08T11:24:41Z")

</div>

@Tim_Parnell  
Doing a few searches, the problem seems to be that you wouldn’t be able to enter the password in the shell. If this is the problem, are you able to use key pairs for authentication?

That’s how we solved this for an internal need on macOS. Just throwing it out there. I can try it out when I get to my desk today.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [October 8, 2020, 2:14pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/29 "2020-10-08T14:14:17Z")

</div>

> [@Greg\_O\_Lone](#):
>
> Doing a few searches, the problem seems to be that you wouldn’t be able to enter the password in the shell. If this is the problem, are you able to use key pairs for authentication?

The problem is that we’re not even _there_ yet. I either get the above message, or no DataAvailable. Christian’s terminal window project should be helpful, so I think I’m just going to wait on the plugin for this.

---

<div class="post-metadata">

**Author:** ![Andrew\_Paul\_Dickey](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@Andrew\_Paul\_Dickey](https://forum.xojo.com/u/Andrew_Paul_Dickey)\
**Post date:** [October 8, 2020, 8:52pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/30 "2020-10-08T20:52:16Z")

</div>

Tim,

Whilst Christian has added this functionality to MBS (and I admire/applaud his zeal, agility, and great customer service in doing so), alternatives configurations/solutions remain available to you (and others).

Three plugin alternatives (or additional solutions):

1. configure password-less (as in stored password) access for SSH on Windows 10 (passthru);
2. install and use sshpass on Windows 10  
`sshpass -p your_password ssh user@hostname`
3. use plink ```  
`plink your_username@yourhost -pw your_password`

> **Some references**
>
> [https://superuser.com/questions/1433917/windows-10-ssh-client-password-less-access](https://superuser.com/questions/1433917/windows-10-ssh-client-password-less-access)  
> [https://serverfault.com/questions/241588/how-to-automate-ssh-login-with-password](https://serverfault.com/questions/241588/how-to-automate-ssh-login-with-password)  
> [https://stackoverflow.com/questions/37243087/how-to-install-sshpass-on-windows-through-cygwin](https://stackoverflow.com/questions/37243087/how-to-install-sshpass-on-windows-through-cygwin)

---

<div class="post-metadata">

**Author:** ![John\_Hansen](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/b4bc9f/32.png) [@John\_Hansen](https://forum.xojo.com/u/John_Hansen)\
**Post date:** [October 8, 2020, 9:00pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/31 "2020-10-08T21:00:50Z")

</div>

Example to use SSH (plink.exe) from putty application with Xojo:

Putty Open Source Licence: [https://www.chiark.greenend.org.uk/~sgtatham/putty/licence.html](https://www.chiark.greenend.org.uk/~sgtatham/putty/licence.html)

This code was written with Xojo 2016 [https://pastebin.com/v4iR8c28](https://pastebin.com/v4iR8c28)

1. Create a working folder: **Test-shell-interactive**

2. Create a new folder in Test-shell-interactive named: **ssh**

3. Download 64bit version of plink.exe from [https://the.earth.li/~sgtatham/putty/latest/w64/plink.exe](https://the.earth.li/~sgtatham/putty/latest/w64/plink.exe)

(Main site: [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) )

1. Copy plink.exe into folder ssh (…\Test-shell-interactive\ssh)

2. cut and paste the XML code from [https://pastebin.com/v4iR8c28](https://pastebin.com/v4iR8c28) into file named: **shell-interactive-1.xojo\_xml\_project**

3. Load the file in Xojo

First time you open the file **shell-interactive-1.xojo\_xml\_project** with Xojo, a Resolve Project Issues window appears. Click on the check box plink and select resolve. Then browse and select plink.exe in subfolder **ssh** (…\Test-shell-interactive\ssh)

**Buttons:**

Most of the buttons speaks for it self.

Login button you only use once and when you are finished using the remote shell, it’s very important you press the “Close Shell” button.

The Close Shell button send a chr(3) to the remote host and will close the shell on the remote host. If you close the application without first execute Shell1.WriteLine(chr(3)) to the remote server. The shell will stays active, and next time you do a remote login another shell is created.

 ![ssh-picture-1](https://forum.xojo.com/uploads/default/original/2X/8/84cb1084599a0c7e26f4e8f551b60fa68a6405f2.png)

 ![ssh-picture-2](https://forum.xojo.com/uploads/default/original/2X/7/734c380db34aae5a3d9df5aa7005cc4480c202c2.png)

 ![ssh-picture-3](https://forum.xojo.com/uploads/default/original/2X/9/91c59937bec0e0485a59b5a939e29d109106cde2.png)

---

<div class="post-metadata">

**Author:** ![Andrew\_Lambert](https://forum.xojo.com/user_avatar/forum.xojo.com/andrew_lambert/32/215_2.png) [@Andrew\_Lambert](https://forum.xojo.com/u/Andrew_Lambert)\
**Post date:** [October 8, 2020, 11:41pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/32 "2020-10-08T23:41:28Z")

</div>

I’ve been working on an open source binding to libssh2: [https://github.com/charonn0/RB-libssh2](https://github.com/charonn0/RB-libssh2)

It’s still not 100% complete (in particular there’s no DataAvailable event) but it is usable with password, keys, or agent based authenticaction:

```
  Dim sh As SSH.Channel = SSH.OpenChannel("ssh://user:password@public.example.com/")
  Call sh.Execute("uptime")
  Dim result As String
  Do Until sh.EOF
    result = result + sh.Read(1024, 0)
  Loop
  sh.Close
```

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [October 9, 2020, 11:34am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/33 "2020-10-09T11:34:07Z")

</div>

New plugins uploaded, see

> **[MBS Xojo Plugins, version 20.5pr3](https://www.mbsplugins.de/archive/2020-10-09/MBS_Xojo_Plugins_version_205pr)**

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [October 12, 2020, 10:43pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/34 "2020-10-12T22:43:58Z")

</div>

Could you write up some kind of doc “How to build libssh2 for this library” ? Trying to figure this out on my own has me feeling really defeated.

I asked Chrsitan to include a SFTP stream for his libssh2 wrapper, but have been “wish list”-ed which means I can’t use MBS.

---

<div class="post-metadata">

**Author:** ![Andrew\_Lambert](https://forum.xojo.com/user_avatar/forum.xojo.com/andrew_lambert/32/215_2.png) [@Andrew\_Lambert](https://forum.xojo.com/u/Andrew_Lambert)\
**Post date:** [October 13, 2020, 12:22am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/35 "2020-10-13T00:22:25Z")

</div>

I wish I could! Instead I use the pre-built DLL distributed by the libcurl project, available [here](https://curl.haxx.se/windows/dl-7.72.0_5/libssh2-1.9.0_5-win32-mingw.zip).

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [October 13, 2020, 6:03am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/36 "2020-10-13T06:03:09Z")

</div>

Hey, we do have SFTP file transfer in the [CURLSMBS](https://www.monkeybreadsoftware.net/class-curlsmbs.shtml) class already!

---

<div class="post-metadata">

**Author:** ![Andrew\_Lambert](https://forum.xojo.com/user_avatar/forum.xojo.com/andrew_lambert/32/215_2.png) [@Andrew\_Lambert](https://forum.xojo.com/u/Andrew_Lambert)\
**Post date:** [October 13, 2020, 7:10am UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/37 "2020-10-13T07:10:15Z")

</div>

P.S. You also need `libcrypto-1_1.dll`, which is part of OpenSSL.

[https://curl.haxx.se/windows/dl-7.72.0\_5/openssl-1.1.1h\_5-win32-mingw.zip](https://curl.haxx.se/windows/dl-7.72.0_5/openssl-1.1.1h_5-win32-mingw.zip)

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [October 13, 2020, 1:04pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/38 "2020-10-13T13:04:02Z")

</div>

I’d have to write _two_ authentication systems, and handle _two_ different types of classes to use MBS. SFTP _is_ SSH, so I shouldn’t have to.

@Andrew_Lambert’s library won’t make me write it twice. I’d love to use MBS, but you put what I need on “wish list” so I can’t.

(It’s not you, it’s me. I’ve been rewriting this thing since April and am quite tired of doing so.)

---

<div class="post-metadata">

**Author:** ![John\_Hansen](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/b4bc9f/32.png) [@John\_Hansen](https://forum.xojo.com/u/John_Hansen)\
**Post date:** [October 13, 2020, 8:14pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/39 "2020-10-13T20:14:29Z")

</div>

@Tim_Parnell (SFTP stream)  
You should be able use the pscp.exe from putty for this [https://the.earth.li/~sgtatham/putty/latest/w64/pscp.exe](https://the.earth.li/~sgtatham/putty/latest/w64/pscp.exe) via a shell

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:44pm UTC](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708/40 "2021-04-29T16:44:38Z")

</div>



[Previous page](https://forum.xojo.com/t/windows-shell-ssh-stdin-and-xojo/57708.md?page=1)
