Guest User

Untitled

a guest
Feb 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/bin/sh
  2. # Quick script to show all jail users and how they coordinate with main box userlist
  3. for uid in $(awk 'FS=":" {if ($0!~/^\#/) {print $3}}' /usr/jails/*/etc/passwd /etc/passwd | sort -n | uniq); do
  4. echo -n "$uid "
  5. awk 'FS=":", ORS=" " {if ($0!~/^\#/ && $3=='$uid') {print "[" $1 "]"; if ($7=="/usr/sbin/nologin") {print "(#nologin)"}}}' /etc/passwd
  6. awk 'FS=":", ORS=" " {if ($0!~/^\#/ && $3=='$uid') {print FILENAME ":" $1; if ($7=="/usr/sbin/nologin") {print "#"}}}' /usr/jails/*/etc/passwd | sed -E 's|/usr/jails/||g' | sed -E 's|/etc/passwd||g'
  7. echo ""
  8. done
Add Comment
Please, Sign In to add comment