-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to clear out machine information
- Loading branch information
1 parent
29c5bb2
commit 33d30a2
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
echo "==> Autoremove packages and clear the package cache" | ||
apt-get --assume-yes autoremove | ||
apt-get --assume-yes clean | ||
|
||
echo "==> Reset machine ID" | ||
truncate -s 0 /etc/machine-id | ||
[ -f /var/lib/dbus/machine-id ] && truncate -s 0 /var/lib/dbus/machine-id | ||
|
||
echo "==> Remove SSH host keys (will be regenerated on first boot)" | ||
rm --force /etc/ssh/ssh_host_* | ||
|
||
echo "==> Remove the random seed file (will be regenerated on first boot)" | ||
systemctl --quiet is-active systemd-random-seed.service && systemctl stop systemd-random-seed.service | ||
[ -f /var/lib/systemd/random-seed ] && rm --force /var/lib/systemd/random-seed | ||
|
||
echo "==> Clear log files" | ||
find /var/log -type f -delete | ||
|
||
echo "==> Clear the bash history" | ||
export HISTSIZE=0 | ||
truncate -s 0 ~/.bash_history | ||
unset HISTFILE |
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 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