How to deal with “Pseudo-terminal will not be allocated because stdin is not a terminal.”

ssh -t remotehost vim /tmp/x.txt

I know that I can run a command like the above.

But I would like to be able to run any local bash code in a remote machine. For this reason, I’d like to call the remote ‘bash -s’ so that can process any local bash code.

ssh -t remotehost 'bash -s' <<< vim /tmp/x.txt

However, the above example shows “Pseudo-terminal will not be allocated because stdin is not a terminal.” Is there any way to let ssh take local bash code via stdin and run it via the remote ‘bash -s’? Thanks

Leave a Comment