summaryrefslogtreecommitdiff
path: root/tools/cloud-init/GCE/99-debug-user.chroot
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2019-04-15 16:30:35 +0200
committerKim Hagen <kim.sidney@gmail.com>2019-04-15 16:30:35 +0200
commit401165bc85fcb9069182765a38c1289bd12fd6e9 (patch)
tree4a15597c730791a15e84d9867b2b6e3b7118c1e0 /tools/cloud-init/GCE/99-debug-user.chroot
parent812c2aa56d15176001fc295fd1716e0c8fed3cef (diff)
downloadvyos-build-401165bc85fcb9069182765a38c1289bd12fd6e9.tar.gz
vyos-build-401165bc85fcb9069182765a38c1289bd12fd6e9.zip
add debug build for GCE
Diffstat (limited to 'tools/cloud-init/GCE/99-debug-user.chroot')
-rwxr-xr-xtools/cloud-init/GCE/99-debug-user.chroot17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/cloud-init/GCE/99-debug-user.chroot b/tools/cloud-init/GCE/99-debug-user.chroot
new file mode 100755
index 00000000..7b72f898
--- /dev/null
+++ b/tools/cloud-init/GCE/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