Bash, looping over stdin
I usually forget when install samba for the first time in Debian it pulls the whole /etc/passwd db into the samba passwd TDB. ie:
[nic@base-field:~] sudo pdbedit -L
games:5:games
nobody:65534:nobody
proxy:13:proxy
www-data:33:www-data
…
Here’s a quick clean out bash scriptlet.
for VAR in `sudo pdbedit -L | cut -d: -f1`; do
sudo pdbedit -x $VAR;
done
Somewhere out there! » Cleaning up the initial samba passdb.tdb Said,
April 12, 2006 @ 8:51 pm
[…] Following on from the previous receipe: Bash, looping over stdin, here is a better method: sudo pdbedit -L | cut -f1 -d: | grep -v nic | xargs -n1 sudo pdbedit -x […]