10

I am just starting to learn how to use rsync, as I am trying to copy files from one server to another. I am using the following command:

rsync -avzP username@ip.address:/public_html/abc/ /www/abc

After entering the other server's password, I then get the following message:

stdin: is not a tty 
receiving incremental file list 
rsync: change_dir "/public_html/abc" failed: No such file or directory (2) 
sent 8 bytes 
received 101 bytes  8.72 bytes/sec total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1655) [Receiver=3.1.1]

However, directory abc does exist, I can browse it etc. There are no spaces in the name.

Any ideas what this may be caused by?

7
  • Is /public_html located off of the user /home or / or whatever default directory your ssh session will load you into? When you mean by browse to it do you mean via a web page or via command line once remote?
    – kemotep
    Jun 28 '18 at 0:03
  • Is /abc a web server alias?
    – Jeff Schaller
    Jun 28 '18 at 1:22
  • Looks like your shell might be spitting some odd output. Can you show the output of ssh username@ip.address ls -d /public_html/abc? Especially if there is anything besides just the directory shown.
    – BowlOfRed
    Jun 28 '18 at 3:17
  • Thanks for your comments, guys. @kemotep: yes, the folder is located off the user /home default directory. I can browse to it through ssh. Jun 28 '18 at 6:07
  • @JeffSchaller: /abc is not an alias Jun 28 '18 at 6:10
3

You need to add the connection details, eg. for SSH use --rsh=ssh.

Try:

rsync -avzP --rsh=ssh username@ip.address:/public_html/abc/ /www/abc

And make sure the paths are correct. Are these paths absolute or relative: /public_html/abc/, /www/abc?

4
  • Adding the connection details did the trick! And also one of the paths was not absolute. Thanks a bunch! Jun 28 '18 at 6:29
  • 1
    Will due respect, but since this anwer doesn't even address the issue of the source directory not being found on the remote host, I'm wondering why it was accepted. The log in on the host works, or else there would not be a chdir error.
    – Kusalananda
    Jun 28 '18 at 6:59
  • @killer_rabbit Kusulananda's answer is more to the point. You should accept it rather than mine.
    – user147505
    Jun 28 '18 at 13:08
  • @Kusalananda I silently assumed the directories exist, but the paths are incorrect. I should have stated this assumption explicitly. (And present an alternative in case this assertion fails.)
    – user147505
    Jun 28 '18 at 13:10
5

The error comes from the fact that there is no /public_html/abc directory on the remote system.

According to comments, the source directory is actually located in the user's home directory, not at the path /public_html.

Therefore:

rsync -avzP username@ip.address:public_html/abc/ /www/abc

Here, we access public_html/abc in the user's home directory rather than in the root of the filesystem.


The warning stdin: is not a tty comes from the fact that your shell's startup file for interactive shells is being called on the remote host (your ~/.bashrc file, if you are using bash), and you are doing something in it that requires a terminal.

You may edit the shell startup file on the remote machine and insert the following close to the top:

[ ! -t 0 ] && return

This would stop the execution of e.g. ~/.bashrc at that point for all shell sessions whose standard input streams are not attached to a terminal.

0
0

When using stripped out Docker images, SSH isn't always installed and will also lead to this error:

apt-get install openssh-client

-1

First make sure the ssh user have a privilege write to this folder,

/www/abc 

the run this command below

rsync -avzP -e ssh /www/abc user@destinationFolderPath

Note

  • -v "verbose" (-vv will provide more detailed information)
  • -e "ssh options" - specify the ssh as remote shell
  • -a - "archive mode" - it preserves permissions (owners, groups), times, symbolic links, and devices
  • -z compress file data during transfer
  • -P show progress during transfer

CMIIW

1
  • 1
    1. The directory /www/abc is local so ssh is irrelevant. 2. Your rsync suggestion reverses the data flow to that which the OP wanted. 3. It's also syntactically incorrect for what you have described.
    – roaima
    Jun 28 '18 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.