The “tmpwatch ” command in linux is to removes files which haven't been accessed for a period of time. The tmpwatch recursively removes files which haven't been accessed for a given time. Normally, it's used to clean up directories which are used for temporary holding space such as /tmp. If you are noticing "/tmp" getting…
Continue readingTag: ssh
How to recursively change Directory & File permission to 755 & 644 respectively
To change all the directories to 755 (drwxr-xr-x): find /directory_location -type d -exec chmod 755 {} \; To change all the files to 644 (-rw-r- -r- -): find /directory_location -type f -exec chmod 644 {} \;
Continue readingWhitelist IP or IP range in/out using iptables
#Flush existing rules iptables -F # 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…
Continue readingHow to change default SSH port 22 to something else
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…
Continue readingHow to Clear bash / SSH / Terminal command history in Linux
You might need to wipe off the command history that you've executed in your linux system for various reason. Normally when logged into the bash / SSH terminal - if the Up Arrow key is pressed - previously executed commands are shown. To completely delete the history type the following command: # history -c #…
Continue readingHow to disable IPtables Firewall in Linux (Red hat/CentOS/Fedora Core)
Disable / Turn off Linux Firewall (Red hat/CentOS/Fedora Core) Type the following two commands to save the IPtables first and then to stop it (you must login as the root user): # /etc/init.d/iptables save # /etc/init.d/iptables stop Turn off firewall on boot # chkconfig iptables off Enable / Turn on Linux Firewall (Red hat/CentOS/Fedora Core)…
Continue readingHow to know your server inode limit and usage
Shared hosting accounts, Virtual Private server and Dedicated servers - all come with inode lmit. Any file on your Unix (or linux) system is considered as an inode. For example, an email stored in the system is considered as an inode. This way all the systems are restricted to a number of max inodes. If…
Continue readingSSH commands to check Hard Drive usage information in Linux Server
Login to your Linux server using SSH Client (ie, PuTTy) Once you are connected to your server: Use to following command to check Hard Drive and partitions: (without the "#") # df -h It will show you output like this: Filesystem Size Used Avail Use% Mounted on /dev/simfs 489G 42G 447G 9% / none 7.8G…
Continue reading