Server security commands:
1) Make Sure No Non-Root Accounts Have UID Set To 0
awk -F: ‘($3 == “0”) {print}’ /etc/passwd
2) Disable Unwanted Services
Type the following command to list all services which are started at boot time in run level # 3:
chkconfig –list | grep ‘3:on’
3) Find Listening Network Ports
Use the following command to list all open ports and associated programs:
netstat -tulpn
4) OR
nmap -sT -O localhost
nmap -sT -O server.example.com
5) World-Writable Files
Anyone can modify world-writable file resulting into a security issue. Use the following command to find all world writable
and sticky bits set files:
find /dir -xdev -type d \( -perm -0002 -a ! -perm -1000 \) -print
6) Noowner/nobody Files
Files not owned by any user or group can pose a security problem. Just find them with the following command which do not
belong to a valid user and a valid group
find /dir -xdev \( -nouser -o -nogroup \) -print