add a script to add tuer users
authorRalf Jung <post@ralfj.de>
Sat, 9 Nov 2013 12:46:37 +0000 (13:46 +0100)
committerRalf Jung <post@ralfj.de>
Sat, 9 Nov 2013 12:46:37 +0000 (13:46 +0100)
adduser [new file with mode: 0755]

diff --git a/adduser b/adduser
new file mode 100755 (executable)
index 0000000..19b10ce
--- /dev/null
+++ b/adduser
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+USER="$1"
+if [[ -z "$USER" ]]; then
+       echo "Usage: $0 username"
+       exit 1
+fi
+if [[ "$(whoami)" != "root" ]]; then
+       echo "Please get root first"
+       exit 1
+fi
+
+adduser "$USER" --disabled-password
+sudo adduser "$USER" tuer
+cd /home/"$USER"
+mkdir .ssh
+echo -n "I will now open nano, please paste the SSH key in there! "
+read
+nano .ssh/authorized_keys
+chown "$USER": -R .