Example

Remove logs older than 5 days

# find /var/log* -mtime +5 -exec rm {} \;
rm: cannot remove `/var/log/tomcat6': Is a directory
rm: cannot remove `/var/log/proftpd': Is a directory
rm: cannot remove `/var/log/clamav': Is a directory
rm: cannot remove `/var/log/prelink': Is a directory
rm: cannot remove `/var/log/sssd': Is a directory
rm: cannot remove `/var/log/roundcubemail': Is a directory
rm: cannot remove `/var/log/samba': Is a directory
rm: cannot remove `/var/log/samba/old': Is a directory
rm: cannot remove `/var/log/ConsoleKit': Is a directory
rm: cannot remove `/var/log/ntpstats': Is a directory
rm: cannot remove `/var/log/mailman': Is a directory
rm: cannot remove `/var/log/cups': Is a directory
rm: cannot remove `/var/log/audit': Is a directory

Nagois error on CentOS 7
make stage…

./stdio.h:456:1: error: ‘gets’ undeclared here (not in a function)
Edit the studio.h file, and replace:
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
with
#if defined gets
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif

The mail sent by your server’s cron jobs are refused by the recipient server due to:


"Action: failed
Final-Recipient: user;user@domain.com
Status: 5.0.0
Remote-MTA: dns; inbound.smtp.domain.com
Diagnostic-Code: smtp; 553 5.1.8 ... Domain of sender address root@hostname.domain.com does not exist"

Crontab will by default send from $LINUX_USER@$HOSTNAME. You can change this by connecting to the server via SSH, running “crontab -e”, and adding “MAILFROM=VALID_ADDRESS_HERE”. Ideally, the MAILFROM will be set to a mail account hosted on your server, but if it is a valid domain, the recipient address will accept it.

Basics
rDNS (Reverse DNS)

The Reverse DNS for an IP should be set to the EHLO value that is sent in the outgoing mail header. This is generally the HostName of the computer.

This value should also match the outgoing IP address used to send the mail.

On a multi-IP server, if the sending IP does not match the EHLO domain, you may be sending from Postfix. Switching to Qmail may cause the sending IP to match the primary IP on the server, which should correct any mis-matched IP/EHLO issues.

Read More

By default the port 80 for http connection is filtered on Redhat 7 as you can only access this port from the actual localhost and not from any other public host. To open a port 80 on RHEL 7 Linux we need to add an iptables rule. For this RHEL7 uses firewall-cmd. First add your port 80 rule with a following command:

# firewall-cmd --permanent --zone=public --add-port=80/tcp --permanent

Once you add the above firewall rule reload firewall service:


# firewall-cmd --reload


# firewall-cmd --permanent --zone=<zone> --add-service=http


# firewall-cmd --permanent --zone=<zone> --add-port=80/tcp

You can check if the port has actually be opened by running:


# firewall-cmd --zone=<zone> --query-port=80/tcp


# firewall-cmd --zone=<zone> --query-service=http

Add the IP as Eth0 when the primary is Eth1 (no gateway)

# nano /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.168.19.36
netmask 255.255.255.224
hwaddress 0C:C4:7A:6A:0F:E4

auto eth1
iface eth1 inet static
address 206.xxx.xx.xx
netmask 255.255.255.0
gateway 206.xxx.xx.1
hwaddress 0C:C4:7A:6A:0F:E5
dns-nameservers 8.8.8.8 4.4.4.4