Created
September 5, 2022 18:24
-
-
Save mtfy/f7543a93e065bb98733fd43b16cba570 to your computer and use it in GitHub Desktop.
Erase login history for cPanel accounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This is useful if you are running your website | |
# in a shared hosting environment, and don't have | |
# the privileges for editing cPanel or Apache cfg | |
# your self, and don't like the nasty logs | |
# cPanel writes on each login. | |
# | |
# Also shreds shell history for current accont. | |
# To automate this, simply set up a cron job. | |
# | |
user=pi | |
user_home=$(bash -c "cd ~$(printf %q $USER) && pwd") | |
shred -fz -n 33 "$user_home/.lastlogin"; | |
shred -fz -n 33 "$user_home/.bash_history"; | |
sleep 2; | |
rm -f "$user_home/.lastlogin"; | |
rm -f "$user_home/.bash_history"; | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment