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.
but if you are logging in as another user go to home directory of that user which usually at /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.
Step 4 – Now add these lines below to the top of your .bashrc file:
[ -z "$PS1" ] && return
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.
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… 😀
I’ve translated it into Persian:
Would you be able to clarify what is happening when we add: [ -z “$PS1” ] && return to the bash profile?