---
# System prepended metadata

title: Linux Change passwords over and over again
tags: [ccdc, ' NCCDC2019']

---

---
tags: ccdc, NCCDC2019
---
# Linux Change passwords over and over again
``` bash
keep=" -e root -e jwong" # list of users to keep if just one no -e is allowed
# if more than one -e is required before every user
while true; do
    users=$(grep '/bin/bash' /etc/passwd | grep -v $keep  | cut -d ':' -f1)
    for u in $users; do
        pass=$(shuf -n 1 /usr/share/dict/words)"_"$(shuf -n 1 /usr/share/dict/words)"_"$RANDOM
        echo -e $pass'\n'$pass | passwd $u 2> /dev/null
        unset pass
    done
    sleep 1;
done
```