I'm trying to set up a non-root user that is able to rsync files to the webroot of our RHEL 6 server. I have a user set up currently that is in the apache group, as well as the wheel group (in order to allow sudo access per instructions here).
I've tried the following, based on other posts I've found:
rsync -azvP --chown=apache:apache img/test-image.png nonrootuser@1.2.3.4:/var/www/vhosts/test
rsync -azvP --chown=apache:apache --rsync-path="sudo rsync" img/test-image.png nonrootuser@1.2.3.4:/var/www/vhosts/test
Without the --rsync-path
flag, I get this error: rsync: mkstemp "/var/www/vhosts/test/.test-image.png.0OU7WK" failed: Permission denied (13)
.
Adding the --rsync-path
flag, I get sudo: sorry, you must have a tty to run sudo
, and when I comment out the Defaults requiretty
line in /etc/sudoers
as recommended in other posts, I get the sudo: no tty present and no askpass program specified
error. It looks like there's more I could try to troubleshoot from here, but it feels like I'm going down a rabbit hole, and possibly going about the whole thing incorrectly if it's this difficult.
So first off, is this setup of having a non-root user for rsyncing website files to the server common? Is there another preferred way of setting up limited access to the server for web development?
If this type of setup is preferred, any red flags on the configuration I've outlined?