It's just been pointed out that instead of: echo "sid " $(wbinfo --gid-to-sid=$gid) maybe echo "user sid= " $(wbinfo --uid-to-sid=$uid) would be less monotonous, and perhaps even useful. What's that phrase? Sarcasm will get you anywhere?
Don't read this: Turn off nscd before fiddling with anything even remotely LDAP 'y.