Copy Single File To All Users Home Directory
#!/bin/bash
UHOME="/home"
FILE="/etc/skel/.newconfig-file"
USERS=$(cut -d':' -f1 /etc/passwd) # get list of all users
for u in $USERS
do
/bin/cp $FILE ${UHOME}/${u}
chown $(id -un $u):$(id -gn $u) /${UHOME}/${u}/${FILE}
done
Copy Multiles File To All Users Home Directory
UHOME="/home"
FILES="/etc/skel/.newconfig-file /etc/skek/.update-config /chroot/jail/.force.conf"
USERS=$(cut -d':' -f1 /etc/passwd) # get list of all users
for u in $USERS
do
for f in $FILES
do
/bin/cp ${f} ${UHOME}/${u}
chown $(id -un $u):$(id -gn $u) /${UHOME}/${u}/${f}
done
done
No comments:
Post a Comment