I am using a Macbook SSH terminal and generated RSA key pairs and uploaded remote id_rsa.pub
with approved permissions. I can connect with remote Apache web server. I can create, open, move, modify and on preliminary inspection can manage files on the web server, no problem … and generate no error messages.
Surprisingly I can not scp
a folder nor document from my desktop to the remote server. Nor can I scp
a folder or document from the remote server to my desktop. Each time I receive the error message:
stdin: is not a tty
The scp
command to or from the remote web server does not work with either absolute or relative file location references.
My standard syntax looks like this:
From local host:
scp -rp ~/Desktop/foldername username@secureremoteserver.com:~/public_html
From remote host:
scp -rp username@secureremoteserver.com:~/public_html/foldername ~/Desktop/
It appears to be an issue with the stdin: is not a tty
error message.
What's going on?
If this error is preventing the file transfers, how do I resolve the stdin: is not a tty
?
Best Answer
The reason for this is that one of the login scripts on the target server is using
stty...
to set up terminal characteristics. The command fails when it doesn't have a tty, ie when you connect withscp
.The solution is to protect the
stty
so that it runs only when an interactive session is present. There are a number of ways to do this; here are some examples for bash/sh type shells:Ugly:
Works for me:
Recommended elsewhere on SE: