Linux

From SilverRack - Affordable VPS Hosting - Wiki

Jump to: navigation, search

SSH Security Tip

One of the easiest things you can do to prevent SSH brute force attacks on your server is to change the port that SSHD listens on from 22 to something else. To do this, edit your SSHD config file (on Redhat/Centos: /etc/ssh/sshd_config) and add the line "Port 30" (no quotes). Then restart sshd (Redhat/Centos: service sshd restart).

Note: Before you do this, make sure the port is open on the firewall. SilverRack has port 30 open for your use for SSH connections.

Check for Running Process

Here's a handy script that you can use as a cron job to check if a process is running, and restart it if it's not:

SERVICE='myprocess'

if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
    echo "$SERVICE service running, everything is fine"
else
    echo "$SERVICE is not running"
    /restart_myprocess.com
fi