Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Distribution: RedHat 8.0, 7.1 and Enterprise WS 3,4
Posts: 94
Rep:
rsync with permissions, but not as root
Hi,
I'm running linux redhat Enterprise WS v.4 and I'm trying to use rsync to backup some data. In the past I've been able to run a rsync command and using the built-in ssh feature move the data to another machine. Since I ran the rsync as root I was able to keep all the permissions, time stamps and other information about the files being backed up. However, now I'm trying to setup a more permanent system and I'm a little wary about running a process like this as root each night. So, I guess my question is two-fold. The first part is, is there a way to run a rsync backup, not as root, but still keep all the permissions, ownership, and time stamp information? The second part is, if it's not possible, is is pretty safe to run this operation as root? Thanks very much.
Short answers:
1) No, it's not possible. Only the superuser account can change file ownership and permissions for all files
2) You're worrying too much. Running rsync as root is perfectly fine. Consider this: your mail daemon is running as root all day, everyday.
Longer answer:
1) It could be possible to do the ownership and permissions business as a non-root user with the help of sudo, but it overly complicates matters (in my opinion). You create a special user to run the rsync process; the account is disabled from logging in at all (login shell of /bin/false for example). You run the rsync script as this user. Once the rsync completes, the rest of the script goes about changing file ownership and permissions using sudo. You configure sudo to allow the rsync user to run those commands as root and without a password since only root can change those attributes and no password because you don't want to enter that for every file you copied over. I don't know about anything to maintain timestamps...
There may be a much simpler way of accomplishing the above without running as root, but I think you're overly worried about it.
Distribution: Slackware Current, RedHat (RHEL, FC, CentOS), openSuSE, Mac OS X
Posts: 650
Rep:
Dark Helmet is right
it only becomes an issue if there is an exploitable bug in rsync (and there always is), so when a bug is discovered it might be an idea to update rsync. But in the meantime, you're secure.
Besides you still have a firewall between the servers and the rest of the world.
I see this is a very old thread, and I'm pretty much a noob, but there are legitimate reasons for wanting to do this. My VPS was hacked and I had to disable root login. (It is exponentially harder to guess both a user name and a password than just to guess root's password.) Now I'm stuck as to how to backup my data. I'll try "hard way" as described above and pray for the best.
I see this is a very old thread, and I'm pretty much a noob, but there are legitimate reasons for wanting to do this. My VPS was hacked and I had to disable root login. (It is exponentially harder to guess both a user name and a password than just to guess root's password.) Now I'm stuck as to how to backup my data. I'll try "hard way" as described above and pray for the best.
Hello,
Please don't dig up old threads, especially thread-jacking someone elses thread. If you have a question, search the forums first for an answer, and if you have no luck, then by all means create a new thread.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.