0
Follow
0
View

The Linux operating system uses echo to clear wtmp and utmp logs. Can I restore the logs?

dream313 注册会员
2023-02-27 12:15

This answer quotes ChatGPT

In Linux, wtmp and utmp log files record user login and logout information. These log files are stored in /var/log/wtmp and /var/run/utmp files. If you empty these log files with the echo command, the information that was originally stored in the log files will be overwritten, so it is not easy to recover the log files.

Although these log files are themselves binary files, there are tools that can be used to analyze and view them, such as the last and who commands that can read login and logout information from the log files. If the wtmp and utmp files are cleared, you can run the last command to view the previous login information, but the logged out user information cannot be restored.

In addition to using the last and who commands to view the historical login information, you can also use the backup and restore method to recover the deleted log files. If the system backs up these log files regularly, and the backup is made before the log files are emptied, the original log files can be restored from the backup. Otherwise, recovering these log files will be difficult because the information they store has already been overwritten. Therefore, to avoid data loss, you are advised to periodically back up log files and save backup data.

cyflove23 注册会员
2023-02-27 12:15

The echo cleared the wtmp and utmp log files. These files have been permanently deleted and cannot be recovered.

dapi890621 注册会员
2023-02-27 12:15

Little witch referred to bing and GPT part of the content write :
cannot be recovered. After the Linux operating system uses echo to clear the wtmp and utmp log files, the information is cleared and cannot be recovered. wtmp and utmp are files that store system run logs, including login, logout, and user online and offline information. If you clear these logs using the echo command, these logs cannot be obtained.
The answer is not easy, so take it.

scy10101 注册会员
2023-02-27 12:15

Recovery possible. Check whether snapshot backup is enabled on the device. If yes, the device can be restored to the snapshot state.