aboutsummaryrefslogtreecommitdiff
path: root/kvmx-create
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-29 19:11:36 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-29 19:11:36 -0300
commit01c14daaf7fc7251a6936b2d07de910cb188dee9 (patch)
tree931335c510ae8feda2c6652fdbe799d6e06cb77d /kvmx-create
parent1bb5ba4ba52ab907a8bfbe0267ee7bdf327cefa3 (diff)
downloadkvmx-01c14daaf7fc7251a6936b2d07de910cb188dee9.tar.gz
kvmx-01c14daaf7fc7251a6936b2d07de910cb188dee9.tar.bz2
Support for custom username and password at kvmx-create
Diffstat (limited to 'kvmx-create')
-rwxr-xr-xkvmx-create6
1 files changed, 4 insertions, 2 deletions
diff --git a/kvmx-create b/kvmx-create
index 38405a3..7f9270d 100755
--- a/kvmx-create
+++ b/kvmx-create
@@ -105,6 +105,8 @@ function kvmx_config {
kvmx_user_config mirror http://http.debian.net/debian/ "Debian mirror"
kvmx_user_config ssh_support y "Administration using passwordless SSH (y/n)"
kvmx_user_config ssh_custom y "Setup a custom SSH keypair (y/n)"
+ kvmx_user_config user user "Initial user name"
+ kvmx_user_config password $RANDOM "Initial user password"
}
# Load config file
@@ -240,7 +242,7 @@ function kvmx_create_custom {
echo 'root:root' | kvmx_sudo_run chroot $WORK/ chpasswd
# Initial user
- kvmx_sudo_run chroot $WORK/ useradd user -G sudo -s /bin/bash
+ kvmx_sudo_run chroot $WORK/ useradd $user -G sudo -s /bin/bash
if [ "$ssh_support" == "y" ];
if [ "$ssh_custom" == "y" ]; then
@@ -259,7 +261,7 @@ function kvmx_create_custom {
fi
kvmx_sudo_run chroot $WORK/ chown -R user.user /home/user
- echo 'user:user' | kvmx_sudo_run chroot $WORK/ chpasswd
+ echo "$user:$password" | kvmx_sudo_run chroot $WORK/ chpasswd
# Networking
cat <<-EOF | $SUDO tee $WORK/etc/network/interfaces.d/ens3 > /dev/null