Rsync copy fails ("no such file or directory")
Solution 1
You need to add the connection details, eg. for SSH use --rsh=ssh
.
Try:
rsync -avzP --rsh=ssh [email protected]:/public_html/abc/ /www/abc
And make sure the paths are correct. Are these paths absolute or relative: /public_html/abc/
, /www/abc
?
Solution 2
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 [email protected]: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.
Related videos on Youtube
killer_rabbit
Updated on September 18, 2022Comments
-
killer_rabbit over 1 year
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 [email protected]:/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?
-
kemotep almost 6 yearsIs
/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? -
Jeff Schaller almost 6 yearsIs /abc a web server alias?
-
BowlOfRed almost 6 yearsLooks like your shell might be spitting some odd output. Can you show the output of
ssh [email protected] ls -d /public_html/abc
? Especially if there is anything besides just the directory shown. -
killer_rabbit almost 6 yearsThanks for your comments, guys. @kemotep: yes, the folder is located off the user /home default directory. I can browse to it through ssh.
-
killer_rabbit almost 6 years@JeffSchaller: /abc is not an alias
-
killer_rabbit almost 6 years@BowlOfRed: Here is the output I get when running the command you mention: "stdin: is not a tty ls: cannot access /www/abc: No such file or directory"
-
-
killer_rabbit almost 6 yearsAdding the connection details did the trick! And also one of the paths was not absolute. Thanks a bunch!
-
Kusalananda almost 6 yearsWill 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. -
roaima almost 6 years1. The directory
/www/abc
is local sossh
is irrelevant. 2. Yourrsync
suggestion reverses the data flow to that which the OP wanted. 3. It's also syntactically incorrect for what you have described. -
Admin almost 6 years@killer_rabbit Kusulananda's answer is more to the point. You should accept it rather than mine.
-
Admin almost 6 years@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.)