Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Running rsync with sudo ?

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Beans
    185

    Running rsync with sudo ?

    I've been doing incremental backups of my system with rsync for months now,only recently it dawned on me that by backing up the running system as normal user,I was actually leaving out a number of files with -rw-r----- permissions,like say the ufw configuration files among many others
    Code:
    rsync: send_files failed to open "/etc/ufw/after6.rules": Permission denied (13)
    therefore I've resolved to use sudo when running rsync,leaving out (as I used to do already) these directories
    Code:
    --exclude='/mnt' --exclude='/media' --exclude='/proc' --exclude='/sys'  --exclude='/dev'  --exclude='/tmp'  --exclude='lost+found'  --exclude='/var/run'
    is this a good idea? Are there any issues in running rsync as super user,and should I edit my --exclude list accordingly?

  2. #2
    Join Date
    Mar 2008
    Beans
    1,219

    Re: Running rsync with sudo ?

    Rsync works fine with sudo. But you'll probably need to make a full backup first since your previous backups were incomplete.

  3. #3
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    6,697
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Running rsync with sudo ?

    Hi cogset.

    As long as you are using 'sudo rsync' locally, there's no problem at all.

    Most of the security concerns would come when you enable a system to receive root rsync connections over ssh, but that's another story.

    Hope it helps.
    Regards.

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,835
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Running rsync with sudo ?

    Are these backups running as a cron job, or do you have to run them manually? If the latter, I would definitely consider putting the rsync command into root's crontab or, better yet, put the command into a root-executable script and place the script in /etc/cron.daily. Then it will be run automatically each night. This method avoids the use of sudo entirely.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Jun 2012
    Beans
    185

    Re: Running rsync with sudo ?

    These are manual backups that I run locally on my system,as in manually rsyncing the / directory (with the exclude list posted above) of my system on an external USB drive -ssh is not involved at all,in fact I've actually removed it altogether (on a side note,I still can't figure out why desktop distributions mainly intended for home use should come with ssh installed:if someone really needs it,I guess he'll be smart enough to know how to install it).

    Automating the whole process with a cronjob does sound really interesting,however this backup process involves quite a lot of disk activity,and I wouldn't want it to start whilst I am doing something else-this being a desktop computer,I never leave it on overnight:if it is on,it means that I'm actually using it.

  6. #6
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    8,835
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Running rsync with sudo ?

    If you have an older machine around, say a largely unused desktop, you might consider converting it into a file server that runs continuously. Place files you want to save on that and let a cron job run a backup each night. My server has a large external USB drive attached to which I write the backups so there's a second physical copy of every file. (The server also runs RAID1, so each file is duplicated on two parallel hard drives as well. But as they say, and to which I can attest, RAID is not a substitute for backups.)
    Last edited by SeijiSensei; August 10th, 2013 at 04:10 AM.
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    1,273
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Running rsync with sudo ?

    Quote Originally Posted by SeijiSensei View Post
    If you have an older machine around, say a largely unused desktop, you might consider converting it into a file server that runs continuously.
    +1

    Another option that works quite well for me is to use an old laptop (otherwise similar setup--complete with external USB drive). Much better on the electrical bill and provides at least a modicum of battery backup.
    Newb: How far must I jump to clear the ledge halfway down?
    Guru: It's bad to jump off cliffs. Let's look at better options.
    Newb: Stop harping about "best practices" and just tell me.


  8. #8
    Join Date
    Jun 2012
    Beans
    185

    Re: Running rsync with sudo ?

    Quote Originally Posted by DuckHook View Post
    +1

    Another option that works quite well for me is to use an old laptop (otherwise similar setup--complete with external USB drive)
    You lost me:I understand there's this second unity always running as a file server,but to run automated backups,you still have to keep your primary desktop running overnight,unless you've automated the process to shut it down once it's finished?

  9. #9
    Join Date
    Mar 2011
    Location
    19th Hole
    Beans
    1,273
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Running rsync with sudo ?

    I was just riffing off of SeijiSensei's suggestion to use an old desktop as a file server. By substituting an old laptop instead, you get lower electrical usage and battery backup (the laptop still runs even in a short power outage). However, the laptop, like the desktop, would have to be left on all the time.

    It is true that you would have to leave your primary desktop running overnight if you want the rsync process to run when no one is around. However, I can't help asking why you get so much disk activity if rsync is run daily (as would be the case with a cron job)? The beauty of rsync is that it syncs only changed files. My own experience is that it runs a disk-intensive sync the first time, and is relatively quick and easy thereafter, unless you have massive amounts of changed files each day. Therefore, if you schedule the sync to occur every day at, say, lunchtime, it should be hardly noticeable.
    Newb: How far must I jump to clear the ledge halfway down?
    Guru: It's bad to jump off cliffs. Let's look at better options.
    Newb: Stop harping about "best practices" and just tell me.


  10. #10
    Join Date
    Jun 2012
    Beans
    185

    Re: Running rsync with sudo ?

    Quote Originally Posted by DuckHook View Post
    However, I can't help asking why you get so much disk activity if rsync is run daily (as would be the case with a cron job)? The beauty of rsync is that it syncs only changed files. My own experience is that it runs a disk-intensive sync the first time, and is relatively quick and easy thereafter, unless you have massive amounts of changed files each day. Therefore, if you schedule the sync to occur every day at, say, lunchtime, it should be hardly noticeable.
    That's an interesting point:admittedly,I'm lazy about backups (I know...),so I'm not backing up the entire system daily (other stuff,as Firefox profile and email,I backup separately almost daily)-still,I find that full system backups after say a week or more take at least 15-20 mins,and that is excluding some virtual machines that I have installed,because I've found that those take ages.

    Maybe I'm just overcautious,but do you people still use your computer whilst a backup process is running? Is that safe?
    I close all other applications when running rsync,I'm not comfortable with using the system whilst the disk is so busy-maybe I just have a noisy/slow disk.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •