# SSH Command code execution - "Pseudo-terminal will not be allocated.." error

**URL:** <https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970>\
**Category:** Questions\
**Tags:** node, ssh, execute-command\
**Created:** [March 10, 2023, 1:35pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970 "2023-03-10T13:35:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilya\_Gurman](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ilya_gurman/32/22530_2.png) [@Ilya\_Gurman](https://community.n8n.io/u/Ilya_Gurman)\
**Post date:** [March 10, 2023, 1:35pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/1 "2023-03-10T13:35:48Z")

</div>

Hello, I’ve been having lots of fun with n8n but now encountered an issue I can’t seem to resolve.  
So I’m SSH’ing into a hetzner server with the SSH module using the password method, that’s all well.

There my goal is to SSH to ANOTHER server (which already has the public key of the Hetzner server I’m now in) and run a command on that server. This keeps failing with “Pseudo-terminal will not be allocated because stdin is not a terminal..”

- I tried adding -T, -q, same results. Tried -tt, that just hangs forever.
- Images of the node and commands are attached.

If anyone can help out that’d be absolutely fantastic.

 ![Screen Shot 2023-03-10 at 13.32.00](https://europe1.discourse-cdn.com/n8n/original/3X/1/f/1f679196982339fd40b6f47620df890eb7f4bbb7.png)  
 ![Screen Shot 2023-03-10 at 13.32.17](https://europe1.discourse-cdn.com/n8n/original/3X/5/f/5f86fa9a19fdcd87cd83256d0ba179d402953804.png)  
 ![Screen Shot 2023-03-10 at 13.32.42](https://europe1.discourse-cdn.com/n8n/original/3X/7/8/78b549405da661eea78202278639473d854e3d22.png)

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [March 10, 2023, 2:03pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/2 "2023-03-10T14:03:06Z")

</div>

Hey @Ilya_Gurman,

I have not tried using an SSH node to SSH to a jump box then on to another server, I know our SSH sessions are non interactive so it could be that you need to try something like `ssh -t -t hostname bash --noprofile`

---

<div class="post-metadata">

**Author:** ![Ilya\_Gurman](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ilya_gurman/32/22530_2.png) [@Ilya\_Gurman](https://community.n8n.io/u/Ilya_Gurman)\
**Post date:** [March 10, 2023, 3:57pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/3 "2023-03-10T15:57:52Z")

</div>

Thanks for the reply! However Nope, hangs forever. Maybe I could explain my use case and get advice as to how to accomplish that?

- We have automatic API processes that spin up wordpress sites on different servers. The goal is to SSH to this site when it’s created and run a certain command (automatically of course).
- The service we’re using ( **only** ) allows SSH connections via providing a public key & handle to that specific server before connecting.

So my idea was:

- Generate an SSH key pair on the Hetzner server the n8n instance is on (done)
- Whenever a new site is spun, add that same particular public key (from above) to that server (done)
- Use n8n to SSH into the root user of the Hetzner server (done)
- From the established connection, SSH (AGAIN) into the new wordpress site server which would work since the public key is already there, and run a command - ~that’s the issue~

If there’s a better way for me to do this, I’m all ears 🙂

Thanks again.

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [March 10, 2023, 4:00pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/4 "2023-03-10T16:00:16Z")

</div>

Hey @Ilya_Gurman,

If you try the same ssh command from the n8n host itself does it show any messages? The idea you have seems fairly solid and easily doable outside of n8n through a couple of scripts so I don’t see why it can’t be done inside of n8n unless that non interactive side of things is causing an issue. I wonder if it hangs because the key needs to be approved like you see with initial connections sometimes 🤔

---

<div class="post-metadata">

**Author:** ![Ilya\_Gurman](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ilya_gurman/32/22530_2.png) [@Ilya\_Gurman](https://community.n8n.io/u/Ilya_Gurman)\
**Post date:** [March 10, 2023, 4:01pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/5 "2023-03-10T16:01:32Z")

</div>

Yeah that works and was tested (I SSH into the n8n Hetzner server from terminal, then ssh into the new wp server instance I need to, smooth).

---

<div class="post-metadata">

**Author:** ![Ilya\_Gurman](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ilya_gurman/32/22530_2.png) [@Ilya\_Gurman](https://community.n8n.io/u/Ilya_Gurman)\
**Post date:** [March 20, 2023, 9:34pm UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/6 "2023-03-20T21:34:05Z")

</div>

Does anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [March 21, 2023, 7:28am UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/7 "2023-03-21T07:28:33Z")

</div>

Hey @Ilya_Gurman

I forgot to reply back to this one, I was going to give it a test and see what I can come up with I will have a play this morning.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [June 19, 2023, 7:28am UTC](https://community.n8n.io/t/ssh-command-code-execution-pseudo-terminal-will-not-be-allocated-error/23970/8 "2023-06-19T07:28:34Z")

</div>

Closed on June 19, 2023, 7:28am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
