Revisions
-
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,6 +36,7 @@ if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nGranting sudo rights to $NEW_USER\n" adduser $NEW_USER sudo echo "admin ALL = NOPASSWD: ALL" >> /etc/sudoers # make ssh a little more secure printf '\e[1;34m%b\e[m' "\nDisabling ssh root login...\n" -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,6 @@ apt-get -y -qq install ufw ufw allow ssh ufw allow http ufw allow https echo "y" | ufw enable ufw status -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,3 +44,5 @@ if [ ! -d /home/$NEW_USER ]; then sed -e 's/#\{0,1\}PasswordAuthentication .*$/PasswordAuthentication no/' -i /etc/ssh/sshd_config reload ssh fi exit -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,6 +22,8 @@ ufw allow 8080 echo "y" | ufw enable ufw status NEW_USER="${NEW_USER:-admin}" if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nCreating user '$NEW_USER'...\n" adduser --disabled-password --gecos "" $NEW_USER -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ ufw status if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nCreating user '$NEW_USER'...\n" adduser --disabled-password --gecos "" $NEW_USER mkdir /home/$NEW_USER/.ssh chmod 700 /home/$NEW_USER/.ssh -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 12 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,4 @@ #!/bin/bash # - updates ubuntu # - creates a sudo-able non-root user called $user_name (for logging into the server later and doing stuff) # - sets up ssh keys for that user by copying the over from /root/.ssh @@ -12,7 +10,17 @@ printf '\e[1;34m%b\e[m' "\nUpdating the system...\n" apt-get -y -qq update DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade printf '\e[1;34m%b\e[m' "\nCreating user 'taco'...\n" adduser --system --group --gecos "" taco printf '\e[1;34m%b\e[m' "\nSetting up basic firewall...\n" apt-get -y -qq install ufw ufw allow ssh ufw allow http ufw allow https ufw allow 8080 echo "y" | ufw enable ufw status if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nCreating user '$NEW_USER'...\n" @@ -32,17 +40,5 @@ if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nDisabling ssh root login...\n" sed -e 's/^PermitRootLogin .*$/PermitRootLogin no/' -i /etc/ssh/sshd_config sed -e 's/#\{0,1\}PasswordAuthentication .*$/PasswordAuthentication no/' -i /etc/ssh/sshd_config reload ssh fi -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,14 +5,14 @@ # - creates a sudo-able non-root user called $user_name (for logging into the server later and doing stuff) # - sets up ssh keys for that user by copying the over from /root/.ssh # - disables ssh root login (that's what $user_name is for) # - creates a system user "taco" for the taco process to run as # - sets up basic iptables firewall # printf '\e[1;34m%b\e[m' "\nUpdating the system...\n" apt-get -y -qq update DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade NEW_USER=$1 if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nCreating user '$NEW_USER'...\n" @@ -32,7 +32,6 @@ if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nDisabling ssh root login...\n" sed -e 's/^PermitRootLogin .*$/PermitRootLogin no/' -i /etc/ssh/sshd_config sed -e 's/#\{0,1\}PasswordAuthentication .*$/PasswordAuthentication no/' -i /etc/ssh/sshd_config fi printf '\e[1;34m%b\e[m' "\nCreating user 'taco'...\n" @@ -46,3 +45,4 @@ ufw allow https ufw allow 8080 echo "y" | ufw enable ufw status reload ssh -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ #!/bin/bash # usage: ./initial.sh # # - updates ubuntu # - creates a sudo-able non-root user called $user_name (for logging into the server later and doing stuff) @@ -12,7 +12,7 @@ printf '\e[1;34m%b\e[m' "\nUpdating the system...\n" apt-get -y -qq update apt-get -y upgrade NEW_USER=taco if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nCreating user '$NEW_USER'...\n" -
maxogden revised this gist
Jan 22, 2014 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,13 @@ #!/bin/bash # usage: ./initial.sh taco # # - updates ubuntu # - creates a sudo-able non-root user called $user_name (for logging into the server later and doing stuff) # - sets up ssh keys for that user by copying the over from /root/.ssh # - disables ssh root login (that's what $user_name is for) # - creates a system user "taco" # - sets up basic iptables firewall # printf '\e[1;34m%b\e[m' "\nUpdating the system...\n" apt-get -y -qq update apt-get -y upgrade @@ -35,4 +45,4 @@ ufw allow http ufw allow https ufw allow 8080 echo "y" | ufw enable ufw status -
klaemo created this gist
Jan 21, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ printf '\e[1;34m%b\e[m' "\nUpdating the system...\n" apt-get -y -qq update apt-get -y upgrade NEW_USER=$1 if [ ! -d /home/$NEW_USER ]; then printf '\e[1;34m%b\e[m' "\nCreating user '$NEW_USER'...\n" adduser --gecos "" $NEW_USER mkdir /home/$NEW_USER/.ssh chmod 700 /home/$NEW_USER/.ssh printf '\e[1;34m%b\e[m' "\nAdding ssh keys to $NEW_USER...\n" cp /root/.ssh/authorized_keys /home/$NEW_USER/.ssh/ chmod 400 /home/$NEW_USER/.ssh/authorized_keys chown $NEW_USER:$NEW_USER /home/$NEW_USER -R printf '\e[1;34m%b\e[m' "\nGranting sudo rights to $NEW_USER\n" adduser $NEW_USER sudo # make ssh a little more secure printf '\e[1;34m%b\e[m' "\nDisabling ssh root login...\n" sed -e 's/^PermitRootLogin .*$/PermitRootLogin no/' -i /etc/ssh/sshd_config sed -e 's/#\{0,1\}PasswordAuthentication .*$/PasswordAuthentication no/' -i /etc/ssh/sshd_config reload ssh fi printf '\e[1;34m%b\e[m' "\nCreating user 'taco'...\n" adduser --system --group --gecos "" taco printf '\e[1;34m%b\e[m' "\nSetting up basic firewall...\n" apt-get -y -qq install ufw ufw allow ssh ufw allow http ufw allow https ufw allow 8080 echo "y" | ufw enable ufw status