File Permission Audit
Find world-writable files and directories, excluding known-safe locations.
$ webtoolist --script path-audit
Check PATH for missing, duplicate, or world-writable directories.
pathshellauditenvironment#!/usr/bin/env bash
set -euo pipefail
declare -A seen=()
index=0
IFS=: read -r -a parts <<< "$PATH"
for dir in "${parts[@]}"; do
index=$((index + 1))
if [[ -z "$dir" ]]; then
echo "warn empty PATH entry (current directory) at position $index"
continue
fi
if [[ -n ${seen[$dir]:-} ]]; then
echo "warn duplicate: $dir (positions ${seen[$dir]} and $index)"
continue
fi
seen[$dir]="$index"
if [[ ! -d "$dir" ]]; then
echo "warn missing: $dir"
continue
fi
if [[ -w "$dir" && "$(stat -c '%a' "$dir")" =~ [2367]$ ]]; then
echo "warn world-writable: $dir"
fi
echo "ok $dir"
done
./path-audit
PATH=/usr/local/bin:/usr/bin:/bin ./path-audit
Related scripts
Find world-writable files and directories, excluding known-safe locations.
Search filenames interactively with fzf when available, falling back to find.
Inspect sshd configuration for common risky settings without changing anything.
Print active/inactive state for a list of systemd services.