Your IP : 10.128.30.70


Current Path : /usr/bin/
Upload File :
Current File : //usr/bin/sudouseradd

# /bin/bash

## Add New user and add user to wheel group          ##
## then pulls public key in to authorized_keys file  ##
## provided that it exists within flint public site  ##
## (created by robert mckibben 19/11/18)             ##

## Syntax for running script is as follows
## sh sudouseradd.sh [enter username]
## EXAMPLE:  sh sudouseradd.sh dean

USERNAME=$1
PASS=$USERNAME\123
TXT=.txt

useradd $USERNAME
echo $PASS | passwd $USERNAME --stdin
usermod -aG wheel $USERNAME
passwd -e $USERNAME
cd /home/$USERNAME
mkdir .ssh
wget https://resources.beingbuilt.uk/keys/$USERNAME.txt
cat $USERNAME.txt >> /home/$USERNAME/.ssh/authorized_keys
rm $USERNAME.txt
chown $USERNAME:$USERNAME -R .ssh
usermod -aG wheel $USERNAME