19b10ce76dcef8a5a4682ce4ed2f55a4db65744e
[saartuer.git] / addtueruser
1 #!/bin/bash
2
3 USER="$1"
4 if [[ -z "$USER" ]]; then
5         echo "Usage: $0 username"
6         exit 1
7 fi
8 if [[ "$(whoami)" != "root" ]]; then
9         echo "Please get root first"
10         exit 1
11 fi
12
13 adduser "$USER" --disabled-password
14 sudo adduser "$USER" tuer
15 cd /home/"$USER"
16 mkdir .ssh
17 echo -n "I will now open nano, please paste the SSH key in there! "
18 read
19 nano .ssh/authorized_keys
20 chown "$USER": -R .