Security
bash
Intermediate
Linux User Audit Script
List all users with login shells, their last login, and whether they have sudo access.
bash
#!/bin/bash
echo 'User | Last Login | Sudo'
while IFS=: read -r user _ uid _ _ _ shell; do
[ $uid -ge 1000 ] || continue
sudo_access=$(groups $user | grep -q sudo && echo Yes || echo No)
printf '%-15s %s
' $user $sudo_access
done < /etc/passwd
Prerequisites
- bash
- lastlog
- sudo group
Pro Tips
- → Run as root for complete last login info.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- bash
- Level
- Intermediate
- Read time
- 3 min
- Published
- Jan 2025
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
TOTP Two-Factor Auth
Generate and verify time-based one-time passwords (TOTP) compatible with Google Authenticator.
python
·
Advanced
Express CSRF Protection with Double Submit
Implement double-submit CSRF protection in Express without server-side session storage.
javascript
·
Intermediate
ClamAV Malware Scanner Cron
Run ClamAV on upload directory and quarantine infected files automatically.
bash
·
Advanced