How to enumerate a linux machine ?
- User
How to enumerate a linux machine ?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
How to enumerate a linux machine ?
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Enumerating a Linux machine is a critical step in system administration, security auditing, or penetration testing. Below is a structured, detailed guide to enumerate a Linux system, covering key areas like OS details, network configuration, user permissions, services, and vulnerabilities.
# Kernel version and OS release
uname -a
cat /etc/os-release
# Hostname
hostname
# Architecture (32-bit vs 64-bit)
uname -m
# System uptime and load
uptime
# Hardware details (CPU, RAM, disks)
lscpu
free -h
df -h # Mounted filesystems
lsblk # Block devices
# List all interfaces (including inactive ones)
ip addr show
ifconfig -a # For older systems
# Routing table
ip route show
route -n
# Active connections and listening ports
ss -tulnp # TCP/UDP sockets (numeric ports, processes)
netstat -tulnp # Legacy tool
# Check iptables/nftables rules
iptables -L -v -n
nft list ruleset
# Check firewalld (RHEL/CentOS)
firewalld-cmd --list-all
cat /etc/resolv.conf
dig example.com @<DNS_SERVER> # Test DNS resolution
# List all users
cat /etc/passwd
# Check currently logged-in users
who
w
# List sudo privileges (users who can run sudo)
sudo -l
cat /etc/sudoers
# Check login shells and home directories
getent passwd
# List all groups
cat /etc/group
# Groups a user belongs to
groups <username>
id <username>
ps auxf # Full process tree
top -c # Interactive process viewer
htop # Enhanced version of top
# Systemd services (common on modern systems)
systemctl list-units --type=service --state=running
systemctl list-unit-files --type=service
# SysV init services (older systems)
service --status-all
chkconfig --list # For SysV systems
# User-specific cron jobs
crontab -l
# System-wide cron jobs
cat /etc/crontab
cat /etc/cron.*/*
# Check world-writable files/directories
find / -type f \( -perm -0002 \) -exec ls -l {} \;
find / -type d \( -perm -0002 \) -exec ls -ld {} \;
# SUID/SGID binaries (potential privilege escalation vectors)
find / -perm /4000 -exec ls -l {} \;
find / -perm /2000 -exec ls -l {} \;
# Check /etc/shadow permissions (should be 000)
ls -l /etc/shadow
mount | column -t
cat /etc/fstab
# Debian/Ubuntu
dpkg -l
# RHEL/CentOS/Fedora
rpm -qa
# Arch Linux
pacman -Q
# Debian/Ubuntu
apt update && apt list --upgradable
# RHEL/CentOS
yum check-update
# Loaded kernel modules
lsmod
cat /proc/modules
# Kernel version details
cat /proc/version
# Check SELinux status
sestatus
# AppArmor profiles (Ubuntu)
apparmor_status
# System audit logs
grep -i "fail" /var/log/auth.log # Debian/Ubuntu
grep -i "fail" /var/log/secure # RHEL/CentOS
Use tools like LinEnum or linux-exploit-suggester for automated checks:
# Example: Download and run LinEnum
curl -LO https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh
chmod +x LinEnum.sh
./LinEnum.sh -s -k keyword -r report_name -e /tmp/ -t
/etc files, misconfigured sudo./etc/shadow).Let me know if you need guidance on specific tools or deeper analysis! 🔍