Export files using RSYNC and SSH on Mac

Posted January 27, 2017 20k views

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/

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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,

@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.

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


@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.