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
#!/bin/bash | |
# www.fduran.com | |
date; | |
echo "uptime:" | |
uptime | |
echo "Currently connected:" | |
w | |
echo "--------------------" | |
echo "Last logins:" | |
last -a |head -3 |
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
#!/bin/bash | |
# www.fduran.com | |
# script that will send an email to EMAIL when disk use in partition PART is bigger than %MAX | |
# adapt these 3 parameters to your case | |
MAX=95 | |
[email protected] | |
PART=sda1 | |
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1` | |
if [ $USE -gt $MAX ]; then |
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
# chkrootkit & rkhunter: | |
# www.fduran.com | |
http://www.chkrootkit.org/download/ | |
http://sourceforge.net/projects/rkhunter/ | |
cd /usr/local/src/ | |
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz | |
tar zxvf chkrootkit.tar.gz | |
cd chkrootkit-0.49/ | |
./chkrootkit |
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
# symmetric encryption and decryption | |
# www.fduran.com | |
# encryption: | |
gpg -c filename | |
# that creates filename.gpg, filename remains as original, optionally: | |
rm filename | |
# decryption: |
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
# munin stats http://munin-monitoring.org/ | |
# www.fduran.com | |
apt-get update; apt-get install munin munin-node | |
# Apache: add at the end of .conf file or as new sites-available: | |
# Alias /munin "/var/www/munin" | |
# you may want to password-protect the directory | |
/etc/init.d/munin-node start |
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
# monit monitoring http://mmonit.com/monit/ | |
# www.fduran.com | |
apt-get update; apt-get install monit | |
cp /etc/monit/monitrc /etc/monit/monitrc.orig | |
# edit /etc/monit/monitrc see examples at http://mmonit.com/wiki/Monit/ConfigurationExamples | |
# Respawn: |
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
# crucial files integrity check with tripwire http://sourceforge.net/projects/tripwire/ | |
# www.fduran.com | |
apt-get update | |
apt-get install tripwire (enter 2 passwords) | |
# in /etc/tripwire/twpol.txt : | |
# a) in /root section comment out all of them minus result of: | |
ls -la /root | |
# ex:: .bash_history , .bashrc , .profile |
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
# protecting critical linux directories my making them immutable | |
# www.fduran.com | |
chattr +i dir | |
# system dirs to protect: | |
/sbin | |
/bin | |
/usr/sbin | |
/usr/lib |
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
# Linux cloning packages (for Debian/Ubuntu -type) | |
# in server of origin: | |
dpkg --get-selections > packages.txt | |
# in destination server: | |
dpkg --set-selections < packages.txt | |
apt-get -u dselect-upgrade | |
# most packages will work even if destination server is newer distro version |
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
# Use SSH filesystem to mount locally a remote directory through SSH | |
# www.fduran.com | |
# at local server: | |
apt-get update; apt-get install sshfs | |
mkdir /path/to/local/dir | |
# Mounting -persists on logout- (for other ssh port add: -p port): | |
sshfs remoteserver.example.com:/path/to/remote/dir /path/to/local/dir |
OlderNewer