On Friday, July 11, 2014 6:37:03 AM UTC-7, Hylton wrote:
> The Drobo is owned by root and whilst I know the root password, I
> prefer to be logged on as a regular user, using sudo if necessary.
> but it is the syntax of the rsync command that is stopping me from
> executing as rsync can apparently be a BEAST if used incorrectly.
I'm not sure what you mean by "beast", but rsync is generally no worse
or better than any other backup program.
Unfortunately, you have a lot of questions, and answering them requires
some basic unix knowledge, and I don't know how much you know:
1. You need to know the basics of unix file and directory permissions.
2. (Maybe) You need to know how to setup and use ssh, preferably with
ssh certificates (because "recent" versions of rsync use ssh by
default).
You should also have rsync version 3.0.9 or later (because of bugfixes).
Hopefully, that isn't hard for you, as that dates back to 2011. The
latest version is from June 22, 2014 (version 3.1.1), but having that
isn't necessary.
To answer your questions:
* rsync typically writes files as the user that you use. If you happen
to use (for example) the account, "johndoe", rsync will write files
owned by "johndoe", and will require that the destination directory be
writable by "johndoe".
If your destination directory is owned by root and does not allow
writing by "johndoe", rsync is going to fail.
If your destination is owned by root (or any other account), and
allows writing by "johndoe", rsync will work.
If your destination is owned by "johndoe", and you have not done
anything to disallow writes by "johndoe", rsync will work.
HOWEVER, WRITING AS "root" IS SPECIAL, UNLIKE OTHER USERS (like
"johndoe"). That's because, when you write as "root", rsync goes into
a special mode that also preserves file ownerships. When you write as
a regular user (like, "johhdoe") all destination files become owned by
"johndoe", and do not preserve the original file owners.
In your example:
rsync -avh --progress /home root@Umalusi:/drobo/backup-`date +%D`/
You are writing as "root", on the system, "Umalusi". In this case,
rsync will preserve the owners on the destination files.
However, please note that "preserving ownerships" actually means
"preserving numeric user ID ownerships", as unix really does
everything under-the-hood via numeric user IDs. User-friendly names
like "root" and "johndoe" are, well, simply user-friendly names that
you use. Deep down, generally hidden from you, unix handles
everything using numeric user IDs. This is important because, if you
rsync as root, the numeric user IDs should be synchronized between the
two machines. If they're not synchronized, you generally end up with
one or more of:
a. When viewing file ownerships of the backup files (on the
destination system), the files/directories will appear to be owned
by the wrong users.
b. When viewing file ownerships of the backup files (on the
destination system), the files/directories will appear to be owned
by numeric ids (the user names are replaced by numbers).
* You can use a non-root user on the remote system (but see below, as
your example command is likely not what you want):
rsync -avh --progress /home johndoe@Umalusi:/drobo/backup-`date +%D`/
This will cause all files on the destination system (Unalusi) to be
owned by "johndoe". If you're only backing up your own user files
(assuming that your login is "johndoe"), this isn't a problem. If
you're backing up files for multiple users, or for system users, this
is a problem.
* Your example command does not need an rsync server/daemon (you can set
this up if you want, but it's overkill for what you're trying to do).
However, you do need to be able to login to the destination system
using ssh (logins via ssh need to be enabled on the destination
system).
* Since "recent" versions of rsync uses ssh, setting up ssh certificate
authentication means that you don't need to enter a password. (On the
other hand, maybe you want to enter some password.)
Well, you could use rlogin instead of ssh, but that's a bad practice,
as rlogin is insecure. (Now, the network that you're using might be
"secure" enough to use rlogin, but using rlogin is still a bad habit.)
* Your command isn't quite right:
rsync -avh --progress /home root@Umalusi:/drobo/backup-'date +%D'/
It should probably be:
rsync -avh --progress /home root@Umalusi:/drobo/backup-`date +%D`/
(You need to use single BACKquotes instead of single FORWARD quotes.)
However, this will still not do what you want:
> This would, I believe, recursively copy all items in the /home
> directory, archiving files and folders, being verbose, and provide a
> human readable progress indicator, and place them in a
> dated(yyyymmdd) folder on the backup medium with full path being
> under /Drobo/backup-yyyymmdd/?
This will attempt to write to directories below (NOTE: "/drobo", not
"/Drobo" -- unix filesystems are typically case sensitive):
/drobo/backup-mm/dd/yy/
Which, since there are additional directory separators, will likely
cause rsync to fail unless you create that directory BEFORE running
rsync. For today, "date +%D" returns "07/11/14", and so this
directory would be used:
/drobo/backup-07/11/14/
Please read the man page for "date" -- that explains that "%D" means
"mm/dd/yy" (which might be affected by your locale, but I'm not sure).
You probably want to use something like "date +%Y%m%d" (for
"20140711") or maybe "date +%Y-%m-%d" ("2014-07-11"). Don't use
directory separators in the specification, unless you want to create
that directory before running rsync.
So, your command would be something like:
rsync -avh --progress /home root@Umalusi:/drobo/backup-`date +%Y%m%d`/
or:
rsync -avh --progress /home root@Umalusi:/drobo/backup-`date +%Y-%m-%d`/
(Again, backward single quotes -- not forward single quotes.)