![]() |
![]() ![]() ![]() findunusedUID |
#!/bin/bash
# A quick script to search through /etc/passwd and find all the UID's
# that are not listed as the owner of any files on a system. It's
# ugly, and does things in a slow, ungainly way - but it does work... :)
#
for ID in `cat /etc/passwd | cut -d':' -f 3 | sort -n`; do
files=`find / -uid $ID 2>/dev/null` if [ -z "$files" ]; then U=`perl -e"print '', (getpwuid($ID))[0]"` echo "$U (UID $ID) owns no files" fidone | |
[Append to This Answer] | |
2000-Aug-07 11:12pm |
Previous: |
![]() |
|
This FAQ administered by sauer@cloudmaster.com |