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

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.

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

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 :slight_smile:

Thanks again.

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 :thinking:

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).

Does anyone have any ideas?

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.

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