<commit_before>#!/bin/bash -e
echo "========== Add Authorized Keys"
rm -rf /opt/authorized_keys_command.sh
cp  /var/server-basics/amazon/ec2/ssh/authorized_keys_command.sh /opt/authorized_keys_command.sh
chmod +x /opt/authorized_keys_command.sh
sed -i 's:#AuthorizedKeysCommand none:AuthorizedKeysCommand /opt/authorized_keys_command.sh:g' /etc/ssh/sshd_config
sed -i 's:#AuthorizedKeysCommandUser nobody:AuthorizedKeysCommandUser nobody:g' /etc/ssh/sshd_config

echo "========== Add Importing of Users via Crontab"
crontab -l > /tmp/cron

rm -rf /opt/import_users.sh
cp  /var/server-basics/amazon/ec2/ssh/import_users.sh /opt/import_users.sh
chmod +x /opt/import_users.sh

echo "*/10 * * * * root /opt/import_users.sh" >>  /tmp/cron

crontab /tmp/cron
rm -rf /tmp/cron

echo "========== Run Initial Import"
/opt/import_users.sh

echo "========== Remove Ec2 User"
userdel ec2-user

echo "========== Restart SSH Service"
service sshd restart<commit_msg>Added Setup and SSH Lock<commit_after>#!/bin/bash -e
lockfile=/var/tmp/sshlock
if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then

		trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT


        echo "========== Add Authorized Keys"
        rm -rf /opt/authorized_keys_command.sh
        cp  /var/server-basics/amazon/ec2/ssh/authorized_keys_command.sh /opt/authorized_keys_command.sh
        chmod +x /opt/authorized_keys_command.sh
        sed -i 's:#AuthorizedKeysCommand none:AuthorizedKeysCommand /opt/authorized_keys_command.sh:g' /etc/ssh/sshd_config
        sed -i 's:#AuthorizedKeysCommandUser nobody:AuthorizedKeysCommandUser nobody:g' /etc/ssh/sshd_config

        echo "========== Add Importing of Users via Crontab"
        crontab -l > /tmp/cron

        rm -rf /opt/import_users.sh
        cp  /var/server-basics/amazon/ec2/ssh/import_users.sh /opt/import_users.sh
        chmod +x /opt/import_users.sh

        echo "*/10 * * * * root /opt/import_users.sh" >>  /tmp/cron

        crontab /tmp/cron
        rm -rf /tmp/cron

        echo "========== Run Initial Import"
        /opt/import_users.sh

        echo "========== Remove Ec2 User"
        userdel ec2-user

        echo "========== Restart SSH Service"
        service sshd restart

        trap - INT TERM EXIT
else
    	echo "Lock Exists: $lockfile owned by $(cat $lockfile)"
fi
{'fraction_non_alphanumeric': 0.15172413793103448, 'fraction_numerical': 0.005603448275862069, 'mean_word_length': 3.1971066907775767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1322410', 'n_tokens_mistral': 844, 'n_tokens_neox': 787, 'n_words': 183}