summaryrefslogtreecommitdiff
path: root/tools/cloud-init/99-debug-user.chroot
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-07-23 17:07:34 +0700
committerGitHub <noreply@github.com>2019-07-23 17:07:34 +0700
commitd11d4b6e44b6db649b2402500c955af5f8d310c6 (patch)
tree613944f1de089105950a86501507b6aa2151380d /tools/cloud-init/99-debug-user.chroot
parentb229f0bd958a42c6faa345c91500c2ed8ccdc919 (diff)
parent6056acfa06c2b79ee8981b9f36a1ced2dac29111 (diff)
downloadvyos-build-d11d4b6e44b6db649b2402500c955af5f8d310c6.tar.gz
vyos-build-d11d4b6e44b6db649b2402500c955af5f8d310c6.zip
Merge pull request #57 from runborg/equuleus-merged
Sync equuleus with current.
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