Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
Created September 25, 2015 16:44
Show Gist options
  • Save rushipkar90/54ea57f7f753e246a006 to your computer and use it in GitHub Desktop.
Save rushipkar90/54ea57f7f753e246a006 to your computer and use it in GitHub Desktop.
rsync_homedir_fix.sh
#!/bin/bash
for rspaths in `grep path /etc/rsyncd.conf |awk '{print $3}'`; do
username=`echo $rspaths|awk -F/ '{print $3}'`;
realpath=`grep $username /etc/passwd|awk -F: '{print $6}'`;
#echo "DEBUG: realpath variable = $realpath";
#echo "DEBUG: rspaths variable = $rspaths";
if [ -n "$realpath" ]; then
if [ "$rspaths" != "$realpath/" ]; then
echo "user $username path is incorrect! Fixing..."
sed -i -e "s@$rspaths@$realpath/@g" /etc/rsyncd.conf
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment