master
Caleb 12 months ago
parent fc10c32169
commit e49809c4d5

@ -1,7 +1,8 @@
#!/bin/bash
# Backup configs
cp -r /etc /var/log/zds/etc_backup
mkdir /var/zds
cp -r /etc /var/zds/etc_backup
if type apt-get &>/dev/null
then
@ -16,10 +17,34 @@ else
fi
# Set user passwords and sweep keys
mkdir -p /var/log/bash_hist
mkdir -p /var/log/auth_keys
mkdir -p /var/zds/bash_hist
mkdir -p /var/zds/auth_keys
mkdir -p /var/log/zds
if [[ -e /root ]]
then
mv -f /root/.bash_history /var/zds/bash_hist/bash_history_ir_root 2> /dev/null
mv -f /foot/.ssh/authorized_keys /var/zds/auth_keys/root.authorized_keys 2> /dev/null
fi
if [[ -e /home/sysadmin ]]
then
admin_user="sysadmin"
mv -f "/home/$admin_user/.bash_history" /var/zds/bash_hist/bash_history_ir 2> /dev/null
mv -f "/home/$admin_user/.ssh/authorized_keys" "/var/zds/auth_keys/$admin_user.authorized_keys" 2> /dev/null
fi
if [[ -e /home/admin ]]
then
admin_user="admin"
mv -f "/home/$admin_user/.bash_history" /var/log/bash_hist/bash_history_ir 2> /dev/null
mv -f "/home/$admin_user/.ssh/authorized_keys" "/var/zds/auth_keys/$admin_user.authorized_keys" 2> /dev/null
fi
if [[ -e /home/administrator ]]
then
admin_user="administrator"
mv -f "/home/$admin_user/.bash_history" /var/log/bash_hist/bash_history_ir 2> /dev/null
mv -f "/home/$admin_user/.ssh/authorized_keys" "/var/zds/auth_keys/$admin_user.authorized_keys" 2> /dev/null
fi
chmod 700 /var/log/bash_hist
chmod 700 /var/log/auth_keys

Loading…
Cancel
Save