Report this

What is the reason for this report?

How to set permissions on rsync via lsyncd

Posted on May 16, 2018

Hi, I’m new to managing a server and am trying to use lsync to allow a user to SFTP files into a folder here: /var/sftp/uploads

That automatically syncs with a folder in my public web folder. I set up the user using the following: https://www.digitalocean.com/community/questions/trying-to-setup-a-sftp-user-with-limited-access

This worked great, I then set up the lsync using: https://www.digitalocean.com/community/tutorials/how-to-mirror-local-and-remote-directories-on-a-vps-with-lsyncd

This worked great for syncing, but I would like to automatically set all files and directories to chmod 755 when the get synced to the web folder. From the tutorial I believe it would be via rsyncOpts, however from other reading for versions of lsyncd 2.1 and above this is no longer supported (I am running 2.1.5) and should be via rsync = {

From there I get lost, can anyone provide any support?

Thank you!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hi there,

Going through the docs in the offical repo here:

https://github.com/lsyncd/lsyncd/blob/master/default-rsync.lua#L85

I think that you need to specify the following:

    rsync = {
        perms = true
    }

Here is an example of the config that should work:

settings {
    logfile = "/var/log/lsyncd.log",
    statusFile = "/var/run/lsyncd.status"
}

sync {
    default.rsync,
    source = "/path/to/source",
    target = "user@destination:/path/to/destination",
    rsync = {
        perms = true
    }
}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.