23 lines
667 B
Bash
23 lines
667 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
FILE_U="users.txt"
|
||
|
FILE_P="/etc/passwd"
|
||
|
|
||
|
newusers $FILE_U
|
||
|
|
||
|
for line in `cat $FILE_U`
|
||
|
do
|
||
|
user_name=`echo $line | cut -d ':' -f 1`
|
||
|
txt=`cat $FILE_P | grep -e "^$user_name"`
|
||
|
user_id=`echo $txt | cut -d ':' -f 3`
|
||
|
group_id=`echo $txt | cut -d ':' -f 4`
|
||
|
home_dir=`echo $txt | cut -d ':' -f 6`
|
||
|
echo "USER_ID:${user_id} GROUP:${group_id} HOME_DIR:$home_dir"
|
||
|
cp -rf /root/hands-on $home_dir/
|
||
|
sed -i s/userXX/$user_name/g $home_dir/hands-on/terraform/main.tf
|
||
|
cp -rf /root/gitconfig $home_dir/.gitconfig
|
||
|
cp -rf /root/Users/aws-credentials $home_dir/.aws
|
||
|
chown -R $user_id $home_dir
|
||
|
chgrp -R $group_id $home_dir
|
||
|
done
|