create user with sudo priviliges
This commit is contained in:
parent
e7e1a2b990
commit
59e3fe422d
|
@ -0,0 +1,2 @@
|
|||
export _url="hugo-skeleton.home"
|
||||
export _user='ray'
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ] ; then
|
||||
echo "deploy-script.sh: Error - Must supply script as argument"
|
||||
exit
|
||||
else
|
||||
_script="$1"
|
||||
fi
|
||||
|
||||
. ./config.sh
|
||||
|
||||
cat config.sh "$_script" | ssh root@"$_url" "cat >/tmp/deploy-script.sh"
|
||||
ssh root@"$_url" '/bin/bash /tmp/deploy-script.sh'
|
||||
ssh root@"$_url" '/bin/bash -c "rm /tmp/deploy-script.sh"'
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#!/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"
|
||||
|
||||
# TODO test apt-get is used
|
||||
apt-get update && apt-get -y upgrade && apt-get -y install sudo
|
||||
# TODO ensure group sudo is allowed sudo
|
Reference in New Issue