redhat

SELinux Blocking SMTP

So, I ran into an interesting issue today where SELinux in “enforcing” mode was blocking outgoing SMTP from a web application. I figured it was a variable in the SELinux booleans (configuration options). Setting these correctly fixed the problem (but I did disable and re-enable SELinux on both sides of the solution):

# sudo setenforce 0
# sudo setsebool -P httpd_can_sendmail on
# sudo setsebool -P httpd_can_network_connect on
# sudo setenforce 1

Special thanks to the full list of SELinux booleans on the CentOS Wiki – http://wiki.centos.org/TipsAndTricks/SelinuxBooleans

How To Ping Device Using Port Number from Linux

I used nmap and it works like a charm

yum install nmap

[root@apache02 ~]# nmap -p 80 app.testdomain.com

Output:

Starting Nmap 5.51 ( http://nmap.org ) at 2014-06-11 20:48 BST
Nmap scan report for app.testdomain.com (172.16.165.229)
Host is up (0.22s latency).
PORT STATE SERVICE
80/tcp filtered http

Nmap done: 1 IP address (1 host up) scanned in 2.59 seconds

redhat

How To Get Computer Serial Number Using CMD Line in Linux

DMIDECODE
Use dmidecode command. If it’s not on the system, install it first.

yum install dmidecode

Now that it’s installed, run it.

dmidecode -t system

Output Example

SMBIOS 2.3 present.

Handle 0x0100, DMI type 1, 25 bytes.
System Information
Manufacturer: HP
Product Name: ProLiant DL380 G4
Version: Not Specified
Serial Number: XXXXXXXXXXX
UUID: XXXXXXX-XXXXX-XXXXXXX-XXXXXXXX-XXXXXXXX
Wake-up Type: Power Switch

Handle 0x2000, DMI type 32, 11 bytes.
System Boot Information
Status: No errors detected

Variations to use instead of "system":

bios
system
baseboard
chassis
processor
memory
cache
connector
slot

Check Free Disk Space In CentOS and Linux

Both Linux and Unix offer commands to check free disk space.

Check disk usage and free disk space

df -h

or

df -k

 

View how much space one or more files or directories is using

du -sh

-s option summarize the space a directory is using and -h option provides “Human-readable” output

 

Examples of these commands being used and the outputs:

Linux df command

 

 

 

 

 

 

To display the size of files in a given directory:

du -sh *

or

du -csh *