How to Fix Rsync “stdin: is not a tty” error
| |Just recently I tried to establish an SSH connection from my VPS to a Shared Hosting environment trying to download some backup files via rsync. The process went not so smooth, it was successful but with one error notification: stdin: is not a tty.
This time I will not explain about rsync but simply how to get rid that error message so it won’t hogging your log file.
How could such error occur? This is most likely because your remote shell is trying to execute something which needs to run interactively but when you are most likely not in an interactive mode.
How to fix this issue?
Step 1 – Login to your server (remote / local) where you wish to run rsycn or where you wish to establish the ssh from.
Step 2 – Next go to the home directory of your user account.
For example, if you are logging in as root, then go to /root or simply use cd ~ command.
cd ~
but if you are logging in as another user go to home directory of that user which usually at /home/username.
cd /home/username
of course you have to replace username with your own.
But normally, each time you logged in, you should be automatically be in that user home directory.
Step 3 – Edit a file named .bashrc using either nano or vi.
nano .bashrc
pic:
Step 4 – Now add these lines below to the top of your .bashrc file:
[ -z "$PS1" ] && return
pic:
Step 5 – Now save that file and exit. In nano you can simply hit Control+O to save then Control+X to exit.
That’s it. Now your ssh connection will never again encounter “stdin: is not a tty” error.
Kulo Nuwun,
To my surprise, this blog has been written by a woman near by me, and claimed that her job is a housewife, everytime I google the results are mostly from stackoverflow.com, macrumor etc. As I remember this is the first time I get the answer of my problem from a housewife in Surabaya. that is wow….
Could you please give us further explaination why this is happened, I just want to resolve the problem with another way. Puting additional codes in .bashrc or .bash_profile (for some OS) is not really “mak nyus” to me.. It just doesn’t feel elegant if I have many servers for many purposes.
Matur nuwun… 😀
Hi,
I’ve translated it into Persian:
http://blog.jeyserver.com/fix-rsync-stdin-is-not-a-tty/
Would you be able to clarify what is happening when we add: [ -z “$PS1” ] && return to the bash profile?
$PS1 is the prompt string. If this is unset, it implies that the session is not running interactively. The added line tests whether the prompt string is null… and if so it skips execution of the rest of the .bashrc file, avoiding the error.
…thank you so much for this! I kept getting this error message and I had no idea to fix it 😀 You have made me happy today
Very helpful. Cleared up a significant problem for me.
Thanks a lot. It was really useful for me.