Enhance System Security: 10 Critical Commands for Unix-Like Systems

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:

  1. Checking Open Ports:
   nmap -sS -Pn <IP_address>
  • Description: Scans for open ports on the specified IP address.
  1. Checking Listening Services:
   netstat -tuln
  • Description: Displays active listening ports and services.
  1. Checking Firewall Status:
   sudo ufw status
  • Description: Shows the status of the Uncomplicated Firewall (UFW) on Ubuntu-based systems.
  1. Auditing System Security:
   sudo lynis audit system
  • Description: Performs a comprehensive security audit of the system using Lynis.
  1. Listing User Accounts:
   cat /etc/passwd
  • Description: Displays all user accounts on the system.
  1. 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.
  1. 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.
  1. Verifying Installed Packages:
   rpm -Va
  • Description: Checks the integrity of installed packages on RPM-based systems (e.g., CentOS, Red Hat).
  1. Checking for Rootkits:
   sudo chkrootkit
  • Description: Scans the system for known rootkits.
  1. 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.

Leave a Reply