From d8ee537f1528dfe3e37ad1afe2b9dd3dab81cbd0 Mon Sep 17 00:00:00 2001 From: UnicronNL Date: Tue, 21 May 2019 22:15:55 +0200 Subject: update cloud builds --- tools/cloud-init/99-debug-user.chroot | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 tools/cloud-init/99-debug-user.chroot (limited to 'tools/cloud-init/99-debug-user.chroot') diff --git a/tools/cloud-init/99-debug-user.chroot b/tools/cloud-init/99-debug-user.chroot new file mode 100755 index 0000000..7b72f89 --- /dev/null +++ b/tools/cloud-init/99-debug-user.chroot @@ -0,0 +1,17 @@ +#!/bin/bash +# Script to add a user to Linux system +if [ $(id -u) -eq 0 ]; then + egrep "^debuguser" /etc/passwd >/dev/null + if [ $? -eq 0 ]; then + echo "$username exists!" + exit 1 + else + pass=$(perl -e 'print crypt($ARGV[0], "password")' dKD3UKamS3MQ) + useradd -m -p $pass debuguser + usermod -aG sudo debuguser + [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!" + fi +else + echo "Only root may add a user to the system" + exit 2 +fi -- cgit v1.2.3