25 lines
609 B
Bash
Executable File
25 lines
609 B
Bash
Executable File
#!/bin/sh
|
|
|
|
_cmd_su="su --login $_user -c"
|
|
|
|
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 git
|
|
else
|
|
echo "Error - no package installer found."
|
|
exit 1
|
|
fi
|
|
|
|
$_cmd_su "git config --global user.email '$_git_user_email'"
|
|
$_cmd_su "git config --global user.name '$_git_user_name'"
|
|
|
|
# TODO ensure group sudo is allowed sudo
|