If you are Linux user and you want to know how to clear all login information in Linux, so in this article we will learn how to clear or remove the last login information on a Linux server from the command line.
In the Linux systems there are three standard commands that give the information about last logged in users.
The lastlog command shows the most recent login of all users or of a given user.
lastlog /var/log/lastlog lastb /var/log/btmp Shows the bad login attempts lastlog /var/log/lastlog
Clear Information About Last Logins:
To delete all the information about the last logged in users, you have to clear the files where this information is saved.
For this simply overwrite /var/log/lastlog file.First make a backup of /var/log/lastlog:
cp /var/log/lastlog /root
Now overwrite the file using below command:
# cat > /var/log/lastlog
Press CTR+D to save the changes.
You can use the following command to clear wtmp/btmp:
# >/var/log/wtmp # >/var/log/btmp