summaryrefslogtreecommitdiff
path: root/tools/cloud-init/99-debug-user.chroot
diff options
context:
space:
mode:
authorUnicronNL <kim.sidney@gmail.com>2019-05-21 22:15:55 +0200
committerUnicronNL <kim.sidney@gmail.com>2019-05-21 22:17:02 +0200
commit1f9fdad4697ace9ed3373bcf91fb37d6dbb3bac3 (patch)
tree03e17f64d3ec89fe113abb0d9046aa9d35e5a1b0 /tools/cloud-init/99-debug-user.chroot
parenta51706c0467becdad29046475bfc803f9da0ad0f (diff)
downloadvyos-build-1f9fdad4697ace9ed3373bcf91fb37d6dbb3bac3.tar.gz
vyos-build-1f9fdad4697ace9ed3373bcf91fb37d6dbb3bac3.zip
update cloud builds
Diffstat (limited to 'tools/cloud-init/99-debug-user.chroot')
-rwxr-xr-xtools/cloud-init/99-debug-user.chroot17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/cloud-init/99-debug-user.chroot b/tools/cloud-init/99-debug-user.chroot
new file mode 100755
index 00000000..7b72f898
--- /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