#!/bin/bash
UHOME="/home"
FILEPATH="/etc/skel/.procmailrc"
FILENAME=".procmailrc"
FOLDER1PATH="/etc/skel/spamassassin"
FOLDER1NAME="spamassassin"
FOLDER2PATH="/etc/skel/.spamassassin"
FOLDER2NAME=".spamassassin"
# get list of all users
_USERS="$(awk -F':' '{ if ( $3 >= 500 ) print $1 }' /etc/passwd)"
for u in $_USERS
do
_dir="${UHOME}/${u}/"
if [ -d "$_dir" ]
then
/bin/cp $FILEPATH $_dir
/bin/cp -a $FOLDER1PATH $_dir
/bin/cp -a $FOLDER2PATH $_dir
chown $(id -un $u):$(id -un $u) $_dir${FILENAME}
chown -R $(id -un $u):$(id -un $u) $_dir${FOLDER1NAME}
chown -R $(id -un $u):$(id -un $u) $_dir${FOLDER2NAME}
fi
done
Fuente: http://www.cyberciti.biz/tips/linux-unix-shell-batch-copy.html
No hay comentarios:
Publicar un comentario