From: Vincent Le Gallic Date: Mon, 8 Sep 2014 14:35:47 +0000 (+0200) Subject: [populate_foward] Proprification suite au changement des homes X-Git-Url: http://gitweb.pimeys.fr/?p=scripts-20-100.git;a=commitdiff_plain;h=792d2dd0caa09c5e5d15fbdeca2249e217568fca [populate_foward] Proprification suite au changement des homes --- diff --git a/populate_forward.sh b/populate_forward.sh index b492c9c..70d86ee 100755 --- a/populate_forward.sh +++ b/populate_forward.sh @@ -2,17 +2,18 @@ # Remplir le fichier forward -USER=legallic - -FILE=/home/${USER}/forwards if [ $EUID -eq 0 ] then + USER=${SUDO_USER} + HOMEDIR=$(getent passwd ${USER} | cut -d ":" -f 6) + FILE=${HOMEDIR}/forwards + touch ${FILE} chown ${USER}:users ${FILE} chmod 600 ${FILE} - find /home -mindepth 1 -maxdepth 1 -type d | sort | \ + find /home -mindepth 2 -maxdepth 2 -type d | sort | \ while read -r dossier; do if test -f ${dossier}/.forward;