Created
September 25, 2015 16:44
-
-
Save rushipkar90/54ea57f7f753e246a006 to your computer and use it in GitHub Desktop.
rsync_homedir_fix.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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