TLDR: The issue is caused by the old version of rsync (here in my case 3.1.2
). Just update it to the latest version and that should solve the problem.
The known tested version that has this issue fixed is 3.2.3
.
If you can't install the latest version on older ubuntu, follow here
Install latest version of rsync (3.2.3) on ubuntu 18.04
Old, just kept as a reference:
It turns out that, this is a bug of rsync which was fixed in later versions.
The version provided by google collab is 3.1.2
(buggy), while the latest version is 3.2.3 (which has the issue fixed).
!apt update && apt upgrade -y
doesn't upgrade rsync to 3.2.3
.
Not recommended, follow the method provided above
I needed to manually download and install from here. (And yes, I also had to download and update all the listed dependencies manually the same way).
sudo rsync ...
? – sudodus Sep 29 '21 at 07:00sudo
) to preserve the ownership and permissions,tar -cvzf file.tar.gz "$src_path"
; Read more about tar inman tar
or find a tutorial via the internet. – sudodus Sep 29 '21 at 07:30tar (tar -cvzf file.tar.gz "$src_path") -> works
rsync (rsync -avP "$src_path" "$target_path") -> doesn't work (it'll only work if I have write access for src_path)
I need rsync (I already stated that I can copy it using cp (now also tar, tested)) but want rsync
– Cyber Avater Sep 29 '21 at 07:42-a
and let rsync write with the default ownership/permissions of the target directory, (e.g. replace-a
with-r
). By the way, what file system is it (where your target directory is located)? A linux filesystem (e.g.ext4
) or maybe a Windows or MacOS file system? – sudodus Sep 29 '21 at 07:43