Skip to content

Instantly share code, notes, and snippets.

@jayers99
Last active November 29, 2018 22:32
Show Gist options
  • Save jayers99/4790433a7069dd547f64a6559728c618 to your computer and use it in GitHub Desktop.
Save jayers99/4790433a7069dd547f64a6559728c618 to your computer and use it in GitHub Desktop.
# see all users
sudo cat /etc/shadow
# list all users with a password set to expire
sudo cat /etc/shadow | grep ':90:'
# cut out just the user name
sudo cat /etc/shadow | grep ':90:' | tr ':' ' ' | awk '{print $1}'
# put those users in a var
USER_LIST=$(sudo cat /etc/shadow | grep ':90:' | tr ':' ' ' | awk '{print $1}')
# loop through those users and set expiration really high
for i in $USER_LIST; do echo $i; sudo passwd -x 99999 $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment