This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
install-scripts/user.sh

19 lines
443 B
Bash
Executable File

#!/bin/sh
useradd -m -s /bin/bash "$_user"
groupadd sudo
usermod -aG sudo "$_user"
mkdir /home/"$_user"/.ssh
cp /root/.ssh/authorized_keys /home/"$_user"/.ssh/
chown "$_user": /home/"$_user"/.ssh/authorized_keys
passwd -d "$_user"
chage -d 0 "$_user"
if command -v apt-get ; then
apt-get update && apt-get -y upgrade && apt-get -y install sudo
else
echo "Error - no package installer found."
fi
# TODO ensure group sudo is allowed sudo