0

I am trying to migrate my website data to a new server and keep getting this error. I set up public key access and was able to complete rsync with a .txt file I then wanted to try a directory and it isn't working. This is my first time using rsync so please let me know if you need more information.

Edit: both are remote servers the old is Ubuntu 14.04.4 and the new is Ubuntu 18.04.3

I have sudo permissions on each but I probably dont own the directory I am trying to move. I don't know how to find out.

$ rsync -rt /var/www kiana@123.456.789.00:/home
rsync: recv_generator: mkdir "/home/www" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: readlink_stat("/var/www/vhosts/testing.site.org/wp-config.php") failed: Permission denied (13)
rsync: readlink_stat("/var/www/vhosts/testing.site.org/wp-mail.php") failed: Permission denied (13)
rsync: readlink_stat("/var/www/vhosts/testing.site.org/wordpress") failed: Permission denied (13)
rsync: readlink_stat("/var/www/vhosts/testing.site.org/wp-signup.php") failed: Permission denied (13)
rsync: readlink_stat("/var/www/vhosts/testing.site.org/wp-trackback.php") failed: Permission denied (13)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]
  • 1
    Missing: Actual command used, information about what user you run the command as, and what the permissions and ownerships are on the files. – Kusalananda Sep 11 at 14:19
  • And provide the requested information for both the old and the new server. – NickD Sep 11 at 14:29
  • create /home/www on the remote system, make sure kiana has write permissions for it. then re-run the rsync command. – Grump Sep 11 at 14:46
0

This part here:

rsync: recv_generator: mkdir "/home/www" failed: Permission denied (13)

seems to say that the user kiana does not have sufficient permission on the /home-folder of the remote server in order to write to it.

How to check folder permissions

Performing ls -l | grep home from / on the remote server should give you a tell of who owns the folder and what access permissions it has. Standard for the home-folder is that root:root owns it with 755 as folder permissions (read more about folder and file permissions here)

$ ls -l | grep home
drwxr-xr-x   3 root root  4096 21 mar 14.24 home

This output states that the user root with group root owns the folder (d) home and has full permission (rwx), while others of the group root as well as others has read/execute permission (r-x) but not write permission.

A user having sudo-rights means that said user may temporarily have root-privileges after authentication, which is not really plausible with rsync.

Conclusion

As you are not the actual root user performing the rsync (which by security reasons you shouldn't be), you do not have write-permission on /home folder. I would suggest that you try to save the webserver data in another place where user kiana may be able to write (e.g. /tmp/, /opt/ etc).

0

The is directory permissions /home is typically only writeable by root.
For example, running ls on my machine shows root/root:

$ ls -laF /home
total 12
drwxr-xr-x  3 root     root     4096 Aug 20  2018 ./
drwxr-xr-x 24 root     root     4096 Sep  3 09:00 ../

Your best option is to create a directory in /home by ssh'ing into that machine running:

#Note the sudo, or you'd have to su to root
sudo mkdir /home/www 
#Then change the ownership so the user kiana can write to it:
sudo chown kiana:kiana /home/www

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.