Tuesday, April 27, 2010

vsftpd logging timestamp

SkyHi @ Tuesday, April 27, 2010

While investigating some ftp transfers issues we realized that there was something wrong with the logs generated by vsftpd. The timestamps reported in the vsftpd log were wrong, and the fact that they were always 5 hours behind the actual time made us think this was caused by a timezone issue. The system running this was the latest Centos 5.2 with stock vsftpd package.


After further investigation we realized that vsftpd was not using the system timezone settings but was always logging its messages using GMT. Why would anyone want this? I have no idea, but imo they should change the default value to use the system timezone as that is what the majority of people would expect. In order to fix this, you just have to add to the vsftpd.conf the following line:

use_localtime=YES

as we can see from vsftpd manual page (man vsftpd.conf) if undefined, this defaults to “NO“:

use_localtime – If  enabled, vsftpd will display directory listings with the time in your local time zone. The default is to display GMT. The times returned by the MDTM FTP command are also affected by this option.

Default: NO


After changing this variable as with any other vsftpd options, you have to restart the vsftpd service to activate the change.


REFERENCES

http://linuxsysadminblog.com/2008/12/vsftpd-logging-timestamp/