I have Ssh setup for passwordless execution of the rsync command via sudo.
(command="sudo /usr/local/bin/rsync...") which for the most part works
fine. However, somewhere along the line things aren't running as the right
uid/gid. I get
Oct 11 13:15:40 node15 sudo: back-op : TTY=unknown ;
PWD=/usr/home/back-op ; USER=root ; COMMAND=/usr/local/bin/rsync --server
--daemon .
Oct 11 13:15:40 node15 rsyncd[85934]: rsync: forward name lookup for
homer.cooperativeprinting.com failed: hostname nor servname provided, or
not known
Oct 11 13:15:41 node15 rsyncd[85934]: opendir "/isdn" (in etc) failed:
Permission denied
Oct 11 13:15:41 node15 rsyncd[85934]: rsync error: some files could not be
transferred (code 23) at main.c(410)
in the syslog logs on the host running as the ssh server. This makes no
sense though unless rsync is doing a set[ug]id(2). Unfortunately the
session runs so fast I don't get a chance to do a ps -aux to see what user
it's running as. However, sudo of any other command runs just fine. As a
test I opened sudo for ALL and ran this as the backup user:
$ sudo id
uid=0(root) gid=0(wheel) groups=0(wheel), 5(operator)
$ sudo env
USER=root
MAIL=/var/mail/backup
HOME=/home/backup
PAGER=more
TERM=xterm
BLOCKSIZE=K
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/backup/bin
SHELL=/bin/sh
FTP_PASSIVE_MODE=YES
EDITOR=vi
LOGNAME=root
SUDO_COMMAND=/usr/bin/env
SUDO_USER=backup
SUDO_UID=1005
SUDO_GID=1005
So, sudo'ing is setting up the environment just fine for any other
command, rsync shouldn't make a difference. Rsync even shows the directory
in the listing if I just run rsync to get a listing of the module:
drwx------ 512 2004/06/24 09:27:43 isdn
What am I missing here? I haven't looked at the source yet to see if rsync
is changing users anywhere but that is my next step.
--
Ryan Sommers
ryans@gamersimpact.com