Random initial image password

This commit is contained in:
Bob Mottram 2015-11-23 15:04:05 +00:00
parent a4aca5ddbc
commit 2294979689
1 changed files with 15 additions and 7 deletions

View File

@ -213,7 +213,7 @@ if [ -f ~/.initial_setup ]; then
echo '' echo ''
NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)" NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"
echo "${USER}:${NEW_USER_PASSWORD}"|chpasswd echo "${NEW_USER_PASSWORD}" > ~/login.txt
echo " $NEW_USER_PASSWORD" echo " $NEW_USER_PASSWORD"
echo '' echo ''
@ -229,8 +229,16 @@ EOF
cat >> $rootdir/home/root/.bashrc <<EOF cat >> $rootdir/home/root/.bashrc <<EOF
# initial setup of the system # initial setup of the system
if [ -f ~/.initial_setup ]; then if [ -f ~/.initial_setup ]; then
EOF
echo -n " echo \"${MY_USERNAME}:" >> /home/root/.bashrc
echo -n '$(cat /home/' >> /home/root/.bashrc
echo "${MY_USERNAME}/login.txt)\"|chpasswd" >> /home/root/.bashrc
cat >> $rootdir/home/root/.bashrc <<EOF
freedombone menuconfig freedombone menuconfig
rm ~/.initial_setup rm ~/.initial_setup
EOF
echo " shred -zu /home/${MY_USERNAME}/login.txt" >> $rootdir/home/root/.bashrc
cat >> $rootdir/home/root/.bashrc <<EOF
fi fi
EOF EOF
} }