[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Rsync Permissions Issue



Hal Vaughan wrote:
I'm trying to use rsync to back up from one computer to another. Recently I had used NIS so all my systems had the same user on them so there was never a permission issue. Now I'm trying to back up from my iMac to my Debian server. I can't put the iMac on NIS (or probably could, but it would NOT be fun to set up, I'm sure).

In the past I could use:

rsync -av server::Writing /data/Writing

And all my writing would be backed up from the local /data/writing to the server. Now that I'm not using NIS, I use:

rsync -av me@server::Writing /data/Writing

I get errors when I do that, so after some tinkering, I got some directories to back up and I see that rsync is saving the files as "nobody:nogroup" or with the user number 65534.

My understanding of rsync is that if I use "name@system::Service" that it logs into that server using the specified username, but since rsync is saving files as "nobody," then that's not happening. I do have the systems set up so the server does not allow password logins via ssh and the guest (the iMac) is known user with the rsa id on the server and when I want to ssh to the server, just "ssh server" will get me logged in.

What do I need to do to tell rsync on the host system (the server) to use the specified user name?

I don't know it this is any help. I had to move files from one computer to another and found that the User Names changed. The following is a script that I wrote to move files with maintaining UIDs via SSH. Using this in two transfers worked great. Note: it transfers UID numbers, not names.

   The key is:
  $ sudo tar -zcpf - /home | ssh root@123.456.789.123 \
    "cd /;sudo tar -zxpf -"

#! /bin/bash
#
# To copy files to another computer retaining owner / group.
#
# --------- CONFIGURE SECTION ----------
#
#    Your User name on the Server.  Normally should be
# the same as your Computer User Name.
REMOTEUSERNAME="root"
#
#   Remote IP Address.
REMOTEIP="192.168.1.73"
#
# 0 - usr/local/bin
BACKUPLIST="/usr/local/bin"
#
# 1 - home
# BACKUPLIST="/home"
#
# 2 - Samba
# BACKUPLIST="/srv/samba"
#
# 3 - MySQL
# BACKUPLIST="/var/lib/mysql/m* /var/lib/mysql/n* /var/lib/mysql/t* /var/lib/mysql/w*"
#
# 4 - WWW
# BACKUPLIST="/srv/www"
#
# 5 - /usr/local
# BACKUPLIST="/usr/local/bin /var/local"
#
# Note, run as root
# --------- NO EDITING BELOW THIS LINE ----------
#
for LIST in $BACKUPLIST
do
  echo " "
  echo "Starting $LIST"
  tar -zcpf - $LIST | ssh $REMOTEUSERNAME@$REMOTEIP \
"cd /;sudo tar -zxpf -"
  echo "finished"
done



--
Jerry Perkins
Home page http://jperkins.us/

+ If your life is a hard drive, Christ can be your backup. +


Reply to: