Created
April 11, 2016 12:03
-
-
Save RubenKelevra/8fb6e9d32ada896600a8533d41579108 to your computer and use it in GitHub Desktop.
This file contains 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 characters
echo "admins=(\"ruben\" \"kevin\")" > /mnt/install.sh | |
echo "declare -A sshkeys" >> /mnt/install.sh | |
echo "sshkeys[\"ruben\"]='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDA4VjJnNTVDxtLgQqCzOiPWsy0yBNiv32GzzYPPatKYozL8PW5hDhEWg7h8vMs5Ty77U/qijjNr4VRyKKmvDFv907f6Wg/Fnm0a7+DmzZ6M4jdEJgqM3LJc3V81aXB6vXDCpCHB3orIKVB9xz2zaBdcA1A8eNYmy7paiZZPnjnSTGDt+UNMWfKumD9TAj4zyvH3yc1MdeB2WOvWCdxQXnyVEfS/AvAIZtzZA5D2osCPKouTGpjKZXoRYqJoT7X+GltbkopFZ7As9jEMfxG3Rum8oIOrqhNwy4ipahd50RYLhBXEUFvFQpDNadlbeslgTq/P5feX1z41PUR5OgNP8cd [email protected] | |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIVP7CBN1orjIvx7OOvAaQ6h461ziDZjjgJSseR1GfPvpFizP80+N+6bhrOs8+sz/BxaO1kr9fpArs+g/NmMQobiiXKKmOcR+Wm1y2/LBOrtotmZZJGVQnSoQwwY9K7xhJMGKL4TlktSusvmja5kg2WAf7vW389oYqTfwVq4TgerpPSihn9vVRfVi0827MNfh5agwRIZ/OgWXd6ka/LDByQ0FtV4npFWAwx4/uWphg2t/g6vR7ZoIt5rBSR/E0VqRGMwSbwlbDbYgJTPJ3/lVCrDtVka2r1fuL5f+VyuyYhobtBwkjD5GusIB82XlvIs4KzFTOGVhPpvrmoFKaN1aJ [email protected]_2 | |
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFGe5/7cfDkbssq+byjSC1NEfFRIT9h7q26hKESXl2OSQuNj/vRLXlyF1iz8zwFamg0YSVjWb6KwvydimpfXNp8KQE3DKefEzn85eZMO3igMUl9tlnUQFU8skNFyG0o7aSSvw5P4AF5lFEJWqXT8VIkivU5ejI1Ua62CihwMccZ5LbFsg== ruben@i3-2014-09-22' | |
sshkeys[\"kevin\"]='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQClO6Jdbj7HffLDmAoXr/KU7IYnkL/DvJBodE2UdhzROkc6YNSq7Y4xcfS3wHLH8OtPupbIDURwH/XZw2dflwcjxkHgyDPIQzzA988VJpZeT7DJ8AXx0VzZ0MfbIvksVja6eFgSbkvfU54zKloFFU0ml7UMh7WPwzY0kzhzjkiWnRLiTbERggIeeuQCF5HZvqpIr15ss1R0DLWMsLDL32FmM7tqYQRR5DkbD1T8ALIH3VaTcJhkaiqgW6V27Ps6gK/lEQU9JKFNxfhqF+OsK+pngnC0uppw/r265rymfsHa1SfWQxhYRuxZxafldCnZYgMs9KzGK76pziDHv3rGErCL [email protected]'" >> /mnt/install.sh | |
echo "pacman -Syy" >> /mnt/install.sh | |
echo "pacman -S yaourt --noconfirm" >> /mnt/install.sh | |
echo "sed -i -e 's/ -mtune=generic / -mtune=native /g' /etc/makepkg.conf" >> /mnt/install.sh | |
echo "LISTOFADMINS=''" >> /mnt/install.sh | |
echo 'for admin in "${admins[@]}"; do' >> /mnt/install.sh | |
echo "" >> /mnt/install.sh | |
echo ' useradd -m -g users -G wheel -s /bin/bash $admin' >> /mnt/install.sh | |
echo ' mkdir /home/$admin/.ssh/' >> /mnt/install.sh | |
echo ' touch /home/$admin/.ssh/authorized_keys' >> /mnt/install.sh | |
echo ' chown $admin: -R /home/$admin/.ssh/' >> /mnt/install.sh | |
echo ' chmod 700 /home/$admin/.ssh/' >> /mnt/install.sh | |
echo ' chmod 600 /home/$admin/.ssh/authorized_keys' >> /mnt/install.sh | |
echo ' echo "${sshkeys["$admin"]}" > /home/$admin/.ssh/authorized_keys' >> /mnt/install.sh | |
echo ' LISTOFADMINS+=" $admin"' >> /mnt/install.sh | |
echo 'done' >> /mnt/install.sh | |
echo "sed -i -e 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers" >> /mnt/install.sh | |
echo 'echo "running yaourt with $admin-user"' >> /mnt/install.sh | |
echo 'su $admin -c "yaourt -S rk-server-basic --noconfirm"' >> /mnt/install.sh | |
echo "pkgfile --update" >> /mnt/install.sh | |
echo 'echo -e "\nAllowUsers$LISTOFADMINS" >> /etc/ssh/sshd_config;unset LISTOFADMINS' >> /mnt/install.sh | |
echo "sed -i -e 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#Port 22/Port 1337/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#ClientAliveInterval 0/ClientAliveInterval 2/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#ClientAliveCountMax 3/ClientAliveCountMax 5/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#Banner none/Banner \/etc\/issue/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#MaxStartups 10:30:100/MaxStartups 10:30:100/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "sed -i -e 's/#PermitEmptyPasswords no/PermitEmptyPasswords no/' /etc/ssh/sshd_config" >> /mnt/install.sh | |
echo "passwd -l root" >> /mnt/install.sh | |
echo "systemctl enable dhcpcd" >> /mnt/install.sh | |
echo "systemctl enable sshd" >> /mnt/install.sh | |
echo "systemctl mask tmp.mount" >> /mnt/install.sh | |
echo "crontab /crontab" >> /mnt/install.sh | |
echo "chmod +x /usr/local/bin/issue_update.sh" >> /mnt/install.sh | |
echo "echo noarp >> /etc/dhcpcd.conf" >> /mnt/install.sh | |
echo "mkinitcpio -p linux" >> /mnt/install.sh | |
echo "grub-install $maindevice --target=i386-pc" >> /mnt/install.sh | |
echo "sed -i -e 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=2/' /etc/default/grub" >> /mnt/install.sh | |
echo "grub-mkconfig -o /boot/grub/grub.cfg" >> /mnt/install.sh | |
echo "0 * * * * systemd-tmpfiles --clean | |
*/15 * * * * pacman -Syuw --noconfirm | |
0 */2 * * * pacman-optimize | |
*/1 * * * * /usr/local/bin/issue_update.sh" > /mnt/crontab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment