Generate a random initial password for images
This commit is contained in:
parent
972d4546ff
commit
a4aca5ddbc
|
@ -199,12 +199,28 @@ create_generic_image() {
|
|||
# initial setup of the system
|
||||
if [ -f ~/.initial_setup ]; then
|
||||
clear
|
||||
echo '>>> Freedombone system initial setup <<<'
|
||||
echo "
|
||||
.---. . .
|
||||
| | |
|
||||
|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
||||
| | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
||||
' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
||||
|
||||
Initial setup process
|
||||
"
|
||||
echo 'This is your new password. Use whenever you wish to ssh into'
|
||||
echo 'this system.'
|
||||
echo ''
|
||||
echo 'The first thing you need to do is to change your password, otherwise'
|
||||
echo 'your system will be insecure. Your password should be at least 10'
|
||||
echo 'characters long and contain letters and numbers. Do this now:'
|
||||
passwd
|
||||
|
||||
NEW_USER_PASSWORD="$(openssl rand -base64 12 | cut -c1-10)"
|
||||
echo "${USER}:${NEW_USER_PASSWORD}"|chpasswd
|
||||
echo " $NEW_USER_PASSWORD"
|
||||
|
||||
echo ''
|
||||
echo 'Copy it into a password manager or write it down somewhere.'
|
||||
echo ''
|
||||
read -n1 -r -p "Press any key to continue..." key
|
||||
|
||||
rm ~/.initial_setup
|
||||
sudo su
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue