Skip to content

Instantly share code, notes, and snippets.

@mtfy
Created September 5, 2022 18:24
Show Gist options
  • Save mtfy/f7543a93e065bb98733fd43b16cba570 to your computer and use it in GitHub Desktop.
Save mtfy/f7543a93e065bb98733fd43b16cba570 to your computer and use it in GitHub Desktop.
Erase login history for cPanel accounts
#
# 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