20 lines
452 B
Bash
Executable File
20 lines
452 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."
|
|
exit 1
|
|
fi
|
|
|
|
# TODO ensure group sudo is allowed sudo
|