Ensuring the security of your system is crucial to protect it from unauthorized access and vulnerabilities. Regularly checking your system’s security helps in identifying potential risks and maintaining a robust defense against cyber threats. Below are ten essential commands that can assist you in auditing and securing your Unix-like operating system. Below are 10 commands commonly used to check the security of systems, primarily on Unix-like operating systems such as Linux:
- Checking Open Ports:
nmap -sS -Pn <IP_address>
- Description: Scans for open ports on the specified IP address.
- Checking Listening Services:
netstat -tuln
- Description: Displays active listening ports and services.
- Checking Firewall Status:
sudo ufw status
- Description: Shows the status of the Uncomplicated Firewall (UFW) on Ubuntu-based systems.
- Auditing System Security:
sudo lynis audit system
- Description: Performs a comprehensive security audit of the system using Lynis.
- Listing User Accounts:
cat /etc/passwd
- Description: Displays all user accounts on the system.
- Checking for World-Writable Files:
find / -perm -2 -type f 2>/dev/null
- Description: Finds files that are world-writable, which can be a security risk.
- Checking for SUID/SGID Files:
find / -perm /6000 -type f 2>/dev/null
- Description: Lists files with SUID or SGID permissions, which can pose security risks.
- Verifying Installed Packages:
rpm -Va
- Description: Checks the integrity of installed packages on RPM-based systems (e.g., CentOS, Red Hat).
- Checking for Rootkits:
sudo chkrootkit
- Description: Scans the system for known rootkits.
- Reviewing System Logs:
sh sudo tail -f /var/log/auth.log- Description: Continuously monitors the authentication log for suspicious activity.
These commands provide insights into the security posture of a system, helping to identify potential vulnerabilities and unauthorized activities.
364
Discover more from CONTEXT EDUCATION
Subscribe to get the latest posts sent to your email.

