Created
September 16, 2014 17:36
-
-
Save x684867/779523c2a1743fb75620 to your computer and use it in GitHub Desktop.
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 characters
| #!/bin/bash | |
| # | |
| # setup.sh | |
| # FTP Server Setup | |
| # (c) 2014 Edge Case, Inc. All Rights Reserved. | |
| # sam@edgecase.io | |
| # | |
| [ "$(whoami)" != "root" ] && echo "ERROR: root privileges required." && exit 1 | |
| export DEBIAN_FRONTEND=noninteractive; | |
| export APTOPT='-y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold --force-yes --yes --fix-missing -qq'; | |
| export LESSOPEN="| /usr/bin/lesspipe %s"; | |
| export LESSCLOSE="/usr/bin/lesspipe %s %s"; | |
| cd /root | |
| cp -rfv /home /root/ | |
| mkfs.ext4 /dev/xvdb | |
| mount /dev/xvdb /home/ | |
| echo "/dev/xvdb /home ext4 defaults 1 1" >> /etc/fstab | |
| cp -rfv /root/home/* /home/ | |
| chown admin: /home/admin -R | |
| cp /usr/share/zoneinfo/America/Chicago /etc/localtime; | |
| echo "America/Chicago" > /etc/timezone; | |
| ln -sf /bin/bash /bin/sh; | |
| apt-get update --fix-missing -y | |
| apt-get --yes -y --fix-missing -qq install apt-utils; | |
| apt-get $APTOPT dist-upgrade; | |
| apt-get $APTOPT install curl git-core tcptraceroute sysstat iftop zip wget \ | |
| traceroute vim rsyslog-gnutls python-pip lsof | |
| curl -s compareops.com/monitor|bash | |
| curl -s http://compareops.com/i/deployPaperTrail | bash | |
| groupadd sftp | |
| groupadd sftponlyPassword | |
| groupadd sftponlyKeyBased | |
| mkdir /home/sftp | |
| chgrp sftp /home/sftp | |
| cp -rfv ~/etc/ssh/sshd_config /etc/ssh/sshd_config | |
| cp -rfv ~/etc/motd /etc/motd | |
| /etc/init.d/motd stop && update-rc.d motd remove | |
| rm -rf /etc/init.d/motd | |
| /etc/init.d/sshd restart | |
| sed -i -e 's/session optional pam_motd.so motd=\/run\/motd.dynamic/#removed dynamic motd/' /etc/pam.d/login | |
| sed -i -e 's/session optional pam_motd.so/#removed pam_motd.so/' /etc/pam.d/login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment