Export files using RSYNC and SSH on Mac

January 27, 2017 953 views
WordPress Ubuntu

I am trying to move my local wordpress folder to the server, how when I tried to move the files, I keep getting the error permission denied.

My procedure
/var/www/html$ user@100.200.300.1:/Applications/MAMP/htdocs/wordpresstest/

10 Answers

Please copy/paste the entire command and the entire output. What you provided is not a command.

  • @Woet
    jgacuca567@ubuntu-2gb-nyc3-01:/var/www/html$ rsync jgacuca567@

    This is what I posted, and It didnt work,


You may want to take a look at the guide here at DigitalOcean which covers rsync and syncing local to remote.


by Justin Ellingwood
Rsync is a simple tool for intelligently syncing local and remote directories. In this article we will explore the basic usage of this utility to copy files from directory to directory and from system to system.
  • @jtittle

    I did but I kept getting the error that the files do not exist,

    This is what I did.

    admin@$ rsync admin@

    • If you'd read the tutorial, you'd know that after : comes to the destination directory.

      • @Woet

        This is what I followed

        rsync -a username@remote_host:/home/username/dir1 place_to_sync_on_local_machine

        That was the one I was supposed to use correct?

@Woet , I did but this is the error I keep getting

rsync: change_dir "/Users/jamesvanwaza/Dropbox/htdocs/2017/January" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1655) [Receiver=3.1.1]
rsync: [Receiver] write error: Broken pipe (32)


The command to push updates from a local directory to a remote directory would be:

rsync -a ~/dir1 username@remote_host:destination_directory

So if you're local directory (the one on your computer) is:


... and the remote directory (the one on your Droplet) is:


... then we'd use the following. This assumes you're transferring files as the root user to your Droplet. You'll need to replace DROPLET_IP with your Droplet's Public IP address and make sure you update the paths as this is just an example.

rsync -a /path/to/my/files root@DROPLET_IP:/home/username/files

You have to specify both paths, even if you're running the command from the directory that you're transferring files from. Also note the : between DROPLET_IP and the remote path.

  • Still doesn't work even after updating starting with my path then the droplets path. See my screenshot below.

    • @jgacuca

      I'm not seeing a link to a screenshot :-).

      Are you running this on your local PC/Mac or on the Droplet? It needs to be executed locally on your PC/Mac, not on the Droplet itself as you're wanting to sync files from your local env to the Droplet.

      You want to run it locally as your Droplet has no physical link or connection to your local environment, thus it isn't aware of what does or doesn't exist on it.

      To sync from local to droplet, you need to run the rsync commands locally.

      • @jtittle

        This is the link below


        Are you saying I exit ubuntu and just ran the rsync on the terminal or? I am running it on Mac.

        • @jgacuca

          If you are trying to sync local files and directories from your Mac to your Droplet, you need to run the command I provided from your Mac.

        • @jgacuca

          To better understand, think of and look at the command this way

          rsync -a source destination

          source is where you're transferring files from.

          destination is where you're transferring files to.

          The command I provided was:

          rsync -a /path/to/my/files root@DROPLET_IP:/home/username/files

          In the above ..

          our source is /path/to/my/files (i.e. on your Mac)

          our destination is /home/username/files (i.e. on your Droplet)

          So to transfer files from your Mac to your Droplet, you run the command I provided as-is and replace the source path with the path to your files on your Mac. You then replace the destination path with the path where you want the files from your Mac stored on your Droplet.

          You would then update DROPLET_IP to be your Droplets Public IP address.

@Woet that is where the files are hosted locally.

  • Yes.. so it's not the destination, it's the source. Your droplet is the destination.

    • Ok, I have changed the destination first and still the error occurs.

      See screenshot

      Updated example

      • What is the error? Are you sure user "jgacuca567" has access to /var/www/html?

        • rsync: change_dir "/Users/jamesvanwaza/Dropbox/htdocs/2017/January" failed: No such file or directory (2)
          rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.1]
          Thats the error I keep getting.

          • Please show a screenshot of you executing the updated command with output.

@Woet, let me know how to check if user has access to folder,


  • Why did you suddenly start executing the command on your droplet instead of your Mac?

    • I switched the destination and the source and followed the setup from the example

      rsync -a /path/to/my/files root@DROPLET_IP:/home/username/files

      • You need to execute the command on your Mac, not on your Droplet.

        • Ok, using my screenshots, are you able to write the example for me using rsync then I try by copying and pasting?

          • Execute the same command on your Mac and share a screenshot if it goes wrong.

@Woet I did, and it failed, see error.

On Mac

@Woet, Making Progress, I made a user using dscl, however the permissions is still being denied.

Folder Upload


Starting a new reply as the previous one is at it's limit.

You're not using root as I specified in the command I provided :-). As a result, unless the user you're trying to upload as owns that directory, the command will fail.

For example, you're trying to connect using jgacuca567 in the screenshot. If that user doesn't own the directory /var/www/html, then that user will not be allowed to upload files to it.

You can see who owns the directory by running:

ls -al /var/www

You would need to run (on the Droplet):

chown -R jgacuca567:jgacuca567 /var/www/html

To change ownership of the files and directories if you plan on using that user with rsync. The root user doesn't require any specific permissions simply because it's root and root has access to read and write to any directory or file.

Have another answer? Share your knowledge.