Transferring Files SSH SCP Error Message: 'Stdin: is not a tty'
Solution 1
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 with scp
.
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:
stty ... >/dev/null 2>&1
Works for me:
test -n "$PS1" && stty ...
Recommended elsewhere on SE:
# Check for a bash login shell
case $- in
*i*) stty ... ;;
esac
Solution 2
I am not sure if it matters on OSX sshd implementation but on some systems, when you don't have a tty, the implied home directory with ~/ convention, may not expand and you may get some unexpected results. I know it is not a sure thing but please try with full path names, instead of ~/ construct.
Related videos on Youtube
user2217265
Updated on September 18, 2022Comments
-
user2217265 over 1 year
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 Iscp
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 [email protected]:~/public_html
From remote host:
scp -rp [email protected]:~/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
?-
user2217265 about 11 yearsYes I tried full path and every permutation, same error with rsync.
-
user2914606 over 10 yearsplease edit your post to include that information.
-
n.st over 10 yearsOops, this one's old! My suggestion still applies, though, if you haven't found a solution yet.
-
mikeserv about 10 yearsWhen you first login to
ssh
- as I take it your'e executingscp
from within thessh
session - usessh ${opts} -t
. Or even-tt
if needed.
-
-
user2217265 about 11 yearsIt seems that even providing a full path, the remote server does not recognize the location of the local directory and file and oddly offers a reference to being unable to locate the local directory and file ... giving a url that refers to the 'remote' root. Weird and frustrating.
-
user2217265 about 11 yearsDoes not seem to work with absolute url. Remote server gives error essentially unable to locate the local directory and file to copy.
-
n.st about 10 years@user2217265 Could you please add the exact command and error message to your question?