Delete Login History on Linux Server

On the Linux systems there are three standard commands that show the information about last logged in userslastlastb, and lastlog.

The output of these commands include: login-name, last login time, IP address, port etc.

And sometimes, to keep anonymity, it is required to erase last login history.

Check Login History

To check the last login history, including the history of login attempts that failed, run one of the commands from the table below.

Command Logfile Description
last /var/log/wtmp Lists successful login/logout history
lastb /var/log/btmp Shows the bad login attempts
lastlog /var/log/lastlog Shows the most recent login

You already how to check the last login history in Linux, so now it is time to learn how to clear it.

Delete Login History

As you can see from the table, the information about the last logged in users, including failed attempts to login, is stored in the specific binary files that you can’t edit but can easily empty them.

To remove all the information about the last logged in users, you have to clear the files where this information is kept:

echo > /var/log/wtmp
echo > /var/log/btmp
echo > /var/log/lastlog

Now, you have deleted all information about most recently logged users.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What virtualization software do you use?

We use Parallels Virtuozzo Containers (PVC).

Why is my VPS constantly crashing?

There are several causes to why you may not be able to access your VPS. Some users often mistake...

What kind of support do you offer?

We offer Fully Managed VPS packages. For a list of items that we support, please refer to the...

What kind of software can I install on my VPS?

As you have full root access, you may install any compatible software on your VPS. However, any...

What is Virtuozzo?

Virtuozzo is the VPS technology created by SWsoft which allow us to create isolated VPS servers...