Breaking Systems For Fun And Profit

Promoting Diversity

Add this one as /etc/cron.daily/diversity to give your users the diversity they so rightly deserve.

1
2
3
4
5
#!/bin/bash
for I in $(getent passwd | cut -d: -f1 )
do
  chsh -s $(sort -R /etc/shells | head -n1) ${I}
done

What it does

This will once a day change the default shell of every local account to a random shell selected from all the installed/allowed shells on the system.

Bonus points for remembering that /sbin/nologin is also a allowed shell.

Why it works

  1. Line 2 loops over every username in /etc/passwd
  2. sort -R randomizes the order of lines in a file to stdout
  3. head -n1 grabs the first line of the randomized list of shells.
  4. chsh -s set the default shell for a user.

TL;DR