Skip to content

Instantly share code, notes, and snippets.

@avilum
Created March 9, 2020 09:11
Show Gist options
  • Save avilum/8c19fcd4b2e18143f9bd95c129591d8c to your computer and use it in GitHub Desktop.
Save avilum/8c19fcd4b2e18143f9bd95c129591d8c to your computer and use it in GitHub Desktop.
Print the names of the users that failed to connect to a machine using ssh
cat /var/log/auth.log | grep -i -e "disconnected from invalid user" | awk -F' ' '{print $10}' | sort | uniq # INVALID LOGINS USERNAMES (for bash autocompletion and reverse-i search)
@avilum
Copy link
Author

avilum commented Mar 9, 2020

Can be copied and pasted in your ssh server,
to re-execute on the same machine just ctrl+r and start typing "INVALID", "LOGINS", or "USERNAMES" in uppercase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment