Permission denied using Rsync as root

18,338

From the mainpage for rsyncd.conf:

auth users
       This parameter specifies a comma and space-separated list of usernames
       that will be allowed to connect to this module. The usernames do not need
       to exist on the local system. [...]

I.e., the usernames you choose for the rsync daemon are not linked to the system's users of the same name.

You can, however, set the user-ID and group-ID that the rsync daemon should use when accessing files (at least when you have started the daemon with root priviledges):

uid    This  parameter  specifies  the user name or user ID that file transfers to
       and from that module should take place as when the daemon was run as root.
       In combination with the "gid" parameter this determines what file permissions
       are available. The default is uid -2, which is normally the user "nobody".

gid    This parameter specifies the group name or group ID that file transfers to
       and from that module should take place as when the daemon  was  run  as  root.
       This complements the "uid" parameter. The default is gid -2, which is normally
       the group "nobody".

For example:

uid = johndoe
gid = johndoe
Share:
18,338

Related videos on Youtube

Ash
Author by

Ash

Updated on September 18, 2022

Comments

  • Ash
    Ash over 1 year

    All topics that I've come across involved rsync over ssh or rsync using a user with restricted access.

    I'm getting permission denied (13) errors as root. Here are my config files:

    /etc/rsyncd.conf:

    auth users = backup, root
    secrets file = /etc/rsyncd.secrets
    
    [backupdir]
        path = /backupdir
    

    /etc/rsyncd.secrets (file mode 600, owner root, group root):

    backup:backuppassword
    root:rootpassword
    

    The bash script that performs the rsync:

    export RSYNC_PASSWORD=rootpassword
    
    rsync -a --verbose --delete rsync://root@myserver/backupdir mydestination
    

    The bash script above and mydestination reside on a Win XP machine and myserver is a Debian server.

  • Ash
    Ash over 10 years
    Thanks! That worked. I'm no longer getting permission errors.