diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..388714d --- /dev/null +++ b/config.sh @@ -0,0 +1,2 @@ +export _url="hugo-skeleton.home" +export _user='ray' diff --git a/deploy-script.sh b/deploy-script.sh new file mode 100755 index 0000000..f458a27 --- /dev/null +++ b/deploy-script.sh @@ -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"' + + diff --git a/user.sh b/user.sh new file mode 100755 index 0000000..cb7850a --- /dev/null +++ b/user.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