We don’t play favourites.

Include this somewhere in cron, or just run it yourself from time to time to give your users the diversity they so rightly deserve:

for I in $(getent passwd | cut -d: -f1 )
do
    chsh -s $(sort -R /etc/shells | head -n1) ${I}
done
    • Gabriel Menini
    • January 14th, 2010 6:50pm

    I assume the “-R’ flag to sort randomizes the order.
    However, I don’t have that flag ─neither in Linux(bash) nor in Unix(ksh).

    Anyway, the script is amazing ;-)

      • Mule
      • January 14th, 2010 11:49pm

      The -R flag got introduced in newer versions of sort. Fedora 11 has at it, but I don’t know when it got introduced.
      If you haven’t got a newer version of sort you can use:

      sed -n "$[${RANDOM} % $(wc -l /etc/shells | cut -d' ' -f1) + 1]p" /etc/shells
  1. No trackbacks yet.