#Flush existing rules
# Set up default DROP rule for eth0 (Assuming eth0 is the Ethernet Port)
iptables -P INPUT DROP
# Allow existing connections to continue
iptables -A INPUT -i eth0 -m state –state ESTABLISHED,RELATED -j ACCEPT
# Accept everything from the 192.168.0.x network
iptables -A INPUT -i eth0 -s 192.168.0.0/24 -j ACCEPT
# Allow connections from this host to 192.168.1.10
iptables -A OUTPUT -o eth0 -d 192.168.1.10 -j ACCEPT
To compress in tar.gz format:
tar -cv /directory | gzip > archive.tar.gz
To decompress the tar.gz file:
tar -zxvf archive.tar.gz
Internet connected Linux servers are always vulnerable to exploitation by the hackers/intruders. One of their common attack is through SSH. By default SSH servers are configured to listen to port 22 for SSH connection. Changing the port to something else will definitely add an additional measure in securing the server.
How to Change Default SSH port 22 to something else:
- Connect to your server via SSH (your ssh port is still 22) as the root user.
- Run this command: # vi /etc/ssh/sshd_config
- Find out this line: # port 22
- Delete the hash “#” sign from the beginning of the line and change the port to something else. Note down this new port very carefully. You’ll need to use this port for the SSH connection from the next login.
- Save the file and exit.
- Restart the SSH service by executing this command: # service sshd restart
Now disconnect and try reconnecting with the new SSH port. Make sure you memorize the new port number or note it down somewhere.
You’ve purchased a Cloud server or a Virtual server. The server provider says it comes with an SSD (Solid State Drive). Now you definitely would like to verify whether the storage is indeed SSD or is it simple HDD (Hard Disk Drive). If you’re server is running on any version of Linux OS (kernel version 2.6.29 onwards) – just run the following command:
The result will be Either 1 or 0 . If it is “0” – Congratulations – your storage is indeed an SSD one and if the result is “1” – your storage device is an HDD.
I ran the above command in one of my VPSs. The result is “1” – that is the storage device used here is an HDD.