Totally stumped: Cannot run rsync via ROOTCMD

John G. Heim jheim at
Thu Sep 4 15:43:17 CEST 2014

The script is run  by the FAI installer itself.  Part of the FAI 
installation process is to run scripts in 
faiserver:/srv/fai/config/scripts/(by default)  if the name of the 
script matches a defined class.

As usual, I figured it out a short time after asking this question. It 
finally occured to me to check the rsyncd log on the server. It says 
access is denied because the user is not allowed. The rsync module 
(really just a directory) is configured to allow only root user to 
access. But wouldn't the script be run by root?  I still haven't figured 
that out but just specifying in the rsync command that it should connect 
to the rsync server as root seems to have solved the problem.

The change I made is something like this:

rsync --archive --delete faiserver::local/ /usr/local/


rsync --archive --delete root at faiserver::local/ /usr/local/

Too bad the rsync logs don't say what user name it was trying to connect 
as. There may be some way for me to get an FAI script to tell me what 
the effective user name is but I don't want to mess around with that. 
Anyway, this explains all the symptoms. I could ssh as root to the 
machine on which the install is running and run the script.  But then it 
would connect as root. But I don't know why it isn't root when run as 
part of the FAI install.

On 09/04/14 00:32, Bjarne Bertilsson wrote:
> Hi,
> do you run the script with $ROOTCMD? Then I guess you have to drop the $ROOTCMD inside the script and also copy the rsync pw file to somewhere inside /target.
> Or handle everthing without the chroot.
> /BR
> Bjarne
> Sent from Samsung Mobile
> -------- Original message --------
> From: "John G. Heim" <jheim at>
> Date: 03/09/2014 17:46 (GMT+01:00)
> To: linux-fai at
> Subject: Totally stumped: Cannot run rsync via ROOTCMD
> I have been working on a problem on and off for weeks. I am trying to
> run rsync via a ROOTCMD in a script.  During an install, the rsync does
> nothing. If I ssh to the machine during the install and run the script
> manually, it works. It also works when run via fai softupdate after the
> install.   I've even cut/pasted the rsync command from the script, sshed
> to the machine during the install,typed 'chroot /target', and pasted the
> command into the ssh window. So I know the rsync command works if you
> change root to /target. It's just that during an install, when run via
> the fai installer, it does nothing. I'll cut/paste the whole script at
> the end of this message but here is a list of some of the versions of
> the command that I have tried:
> 1. ${ROOTCMD} rsync --archive --delete --numeric-ids --hard-links
> --password-file=/usr/local/etc/rsyncd.key faiserver::local/ /usr/local/
> 2. ${ROOTCMD} /usr/bin/rsync --archive --delete --numeric-ids
> --hard-links --password-file=/usr/local/etc/rsyncd.key faiserver::local/
> /usr/local/
> 3. ${ROOTCMD} /usr/bin/rsync --progress --archive --delete --numeric-ids
> --hard-links --password-file=/usr/local/etc/rsyncd.key faiserver::local/
> /usr/local/ >> /root/install.log
> 4. ${ROOTCMD} bash -c "/usr/bin/rsync --progress --archive --delete
> --numeric-ids --hard-links --password-file=/usr/local/etc/rsyncd.key
> faiserver::local/ /usr/local/ >> /root/install.log"
> Note: When the script fails during an install, /root/install.log is empty.
> Here is the entire script:
> #! /bin/bash
> error=0 ; trap "error=$((error|1))" ERR
> fcopy -B -m root,root,0600 /usr/local/etc/rsyncd.key
> echo "Beginning rsync"
> ${ROOTCMD} bash -c "/usr/bin/rsync --progress --archive --delete
> --numeric-ids --hard-links --password-file=/usr/local/etc/rsyncd.key
> faiserver::local/ /usr/local/ >> /root/install.log"
> exit $error
> # EOF

More information about the linux-fai mailing list