it.megocollector.com

  • About
  • Links
  • About
  • Links

Remove the Last Login History

admin • March 9, 2016

There are some interesting articles on how to clear out the last login history, however, all of them offer the same result.  From several approaches, I have formulated a short and efficient one-liner.

The three files are /var/log/wtmp (successful login/logout) /var/log/btmp (bad login attempts) and /var/log/lastlog (last logged in). The are respectively accessible via the last, lastb, and lastlog commands.

This approach is offered by many sites.

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

From that I tried the following and this didn't work and produced an error /var/log/[bw]tmp: ambiguous redirect

echo > /var/log/[bw]tmp /var/log/lastlog

However, after trying a few things, I discovered the truncate command.  By using the -s switch and selecting the size of zero, we can achieve a working one-liner.

truncate /var/log/[wb]tmp /var/log/lastlog -s0

Source(s)

  • http://www.shellhacks.com/en/HowTo-Clear-or-Remove-Last-Login-History-in-Linux
  • https://www.cyberciti.biz/faq/howto-display-clear-last-login-information/
  • http://stackoverflow.com/questions/2423281/how-to-empty-truncate-a-file-on-linux-that-already-exists-and-is-protected-i
Tagged: lastlastblastlogLinuxlogin

Post navigation

««Monitor multiple logs simultaneously
ScreenFetch»»

Categories

  • Linux (268)
  • macOS (2)
  • Media (9)
  • Misc (38)
  • Raspberry Pi (3)
  • Scripts (181)
    • AutoIT Scripts (19)
    • INNO Scripts (9)
  • Software Packaging (19)
  • Tips and Tricks (413)
  • Windows (13)
  • Wordpress (44)

Popular

  • i8042prt Event ID 7026 The following boot-start or system-start driver(s) failed to load - 114,377 views
  • Adobe Reader 9 or Adobe Acrobat 9 can not view PDF files in a Web Browser error and fix - 78,027 views
  • EPSON Scan jpeg plug-in unable to write to file error and fix - 53,076 views
  • #1045 – Access denied for user ‘root’@’localhost’ (using password: NO) fix - 49,101 views
  • Convert mAh to mWh and mWh to mAh for Notebook Laptop Batteries - 46,973 views
  • Install JDK (Java Development Kit) on a RedHat Linux System - 46,074 views
  • Create a 7zip Self Extractor (7zS.sfx or 7z.sfx) - 41,239 views
  • eHome Infrared Receiver not recognized by Windows XP - 31,534 views
  • How to share a folder without password in Windows 10 home network - 28,601 views
  • Access Red Hat Enterprise Linux 5 with XManager Remote Control - 26,982 views
  • Microsoft Word Accept and Reject Change Options Greyed Out - 25,060 views
  • Setup JBoss on Red Hat Enterprise Linux 5 (RHEL5) Server - 23,677 views
  • PHP 5.3.2 with IIS6 and FastCGI Installation Guide – Updated - 21,817 views
  • Unlock the McAfee VirusScan Enterprise 8.5i User Interface - 21,370 views
  • Internet Explorer 7 Gold RunOnce Removal - 20,765 views
  • Windows XP SESSION3_INITIALIZATION_FAILED stop error with 0x0000006F fix - 19,588 views
  • How to automate Selenium scripts - 19,260 views
  • atibtmon.exe Runtime Error! [Resolved] - 19,065 views
  • SVCHOST.EXE Application Error 0XC00000FD 0X76A9F4F9 100% CPU Resolved! - 19,062 views
  • How to enable and configure Java JRE to work in Firefox in CentOS 5 and RHEL 5 Linux - 17,946 views
  • How to install the Intel 82845G Graphics driver on Microsoft Vista - 16,860 views
  • Remove WGA Notifications with AutoIT - 16,239 views
  • How to Setup IIS6 with the Tomcat 5 Connector – Step by Step Guide. - 16,033 views
  • Disable firewall on Red Hat Enterprise Linux (RHEL) Server - 15,655 views
  • Internet Explorer 8 Beta RunOnce Removal - 14,998 views
  • Setup JBoss on Ubuntu 8.0.4 LTS Server Edition - 14,379 views
  • Use netstat in Linux to determine port conflicts - 14,184 views
  • How to Sort Text Using Notepad++ - 13,999 views
  • EPSON Print CD missing PICSDK.DLL - 13,707 views
  • DOS Batch – Find and Replace all occurrences of a string with another string - 12,924 views
  • Connect to VNCServer on Red Hat Enterprise Linux - 12,700 views
  • Autorun JBoss on Red Hat Enterprise Linux 5 (RHEL5) Server - 12,088 views
  • Microsoft Office 2003 missing SKU011.CAB - 11,623 views
  • Factory reset the Linksys PAP2 Phone Adapter for Vonage - 11,440 views
  • Unlock Western Digital WD80EB Drives - 10,435 views
  • Create a Bootable Windows XP SP3 Integrated with Post-SP3 fixes CD - 10,307 views
  • RDP into CentOS 7 with XRDP - 9,631 views
  • Setup JBoss on Ubuntu 8.1.0 Server Edition - 9,454 views
  • Vsftpd FTP Server With Virtual Users (CentOS 7) - 8,979 views
  • Innounp, Inno Setup Unpacker 0.23 (Build: 080318) supports INNO Setup 5.2.3 - 8,879 views
  • Create a service for JIRA on CentOS 5 or RHEL 5 - 8,505 views
  • Hot to enable a Symantec Antivirus LiveUpdate that is grayed out - 8,479 views
  • Event ID 1091 Group Policy … failed to log RSOP. - 8,000 views
  • Install Tomcat 5.5.28 on RHEL5 / CentOS5 - 7,973 views
  • Beyond Compare 2.5.3 INNO repack with license key - 7,548 views
  • Install and use ncsd for name service caching - 7,498 views
  • Elasticsearch bootstrap checks failed [RESOLVED] - 7,124 views
  • mAh mWh Calculator - 7,035 views
  • Add Root Certificates to a CentOS Linux Server - 6,978 views
  • How to disable Windows Security Warning “These files might be harmful to your computer” - 6,913 views
Copyright © 2006-2022 it.megocollector.com
Theme by moyu