diff options
author | Daniel Hansson <daniel@techandme.se> | 2017-03-06 22:28:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-06 22:28:27 +0300 |
commit | 1e96a3ed16d8858e1eb55a5fe421ca6d307beafc (patch) | |
tree | 836562f5e9a800b87bea835be832e199810b8693 /static/adduser.sh | |
parent | a297ddbb0240d3182aa05c52476badfcfa57d354 (diff) |
Rename adduser to adduser.sh
Diffstat (limited to 'static/adduser.sh')
-rw-r--r-- | static/adduser.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/static/adduser.sh b/static/adduser.sh new file mode 100644 index 00000000..0dabef61 --- /dev/null +++ b/static/adduser.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# This runs the startup script with a new user that has sudo permissions + +function ask_yes_or_no() { + read -p "$1 ([y]es or [N]o): " + case $(echo $REPLY | tr '[A-Z]' '[a-z]') in + y|yes) echo "yes" ;; + *) echo "no" ;; + esac +} +if [[ "no" == $(ask_yes_or_no "Do you want to create a new user?") ]] +then +echo "Not adding another user..." +sleep 1 +else +echo "Enter name of the new user:" +read NEWUSER +echo "Enter password of the new user" +read NEWPASS +echo "User: $NEWUSER" +echo "Pass: $NEWPASS" +echo "Continues in 5 seconds..." +sleep 5 +adduser --disabled-password --gecos "" $NEWUSER +echo -e "$NEWUSER:$NEWPASS" | chpasswd +gpasswd -a $NEWUSER sudo +sudo -u $NEWUSER sudo bash nextcloud_install_production.sh +fi |