date does not log date changes in wtmp nor utmp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
coreutils (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: coreutils
Apparently, the date command does not log date changes in /var/log/wtmp nor /var/run/utmp.
I need a method to track date/time changes, and I found that it should be logged in wtmp file.
In the man page (man wtmp):
"The wtmp file records... ... logs the old/new system time when date(1) changes it."
Description of my System:
Description: Ubuntu 9.10
coreutils:
Installed: 7.4-2ubuntu1
What I expect to happen:
When I change the date or time with the date command, it should log 2 record in wtmp: ut_type = NEW_TIME and ut_type = OLD_TIME
What happened instead:
The command date changes the date/time and nothing is logged in wtmp/utmp.
Methods to comprove it:
1) With inotify:
1.a) Install inotify-tools package
1.b) open two terminals.
1.c) In one terminal, ejecute: sudo -i
1.d) In the other terminal run: inotifywait -m -r /var/log/
1.e) When the message "Watches established" appears, go to the terminal that is as root, and change the date (date ....)
Nothing happens with /var/log/wtmp.
If you try with /var/run/utmp, also nothing happens.
2) With a C Program
I have done a small C program to try to get the NEW_TIME registers (attached).
It prints the user that changed the time, or "There was no time change" if the NEW_TIME record was not found.
I expected to see my user name or root after a time change with date, but nothing is logged in utmp.
(to compile the file: gcc -o utmp_check printtimechange.c ; to use: ./utmp_check).