When we use the ftp
command or ftp client to connect to a Linux server, the files' modification time shown is different from the time shown in a telnet
session.
For example, I have some *.dat
files in /home/abc/
and the last modification time shown in the ftp
command or client is 19:30. But when I do an ls -l
in my telnet
session, it shows 03:30. The last modification time shown in the telnet session is correct.
Is there a setting that has gone wrong?
Best Answer
After 2 years, today I found out that the cause of the problem is because the FTP timestamps are set to GMT instead of following the correctly set timezone as highlighted in this URL
But in the URL, the change was done to the
/etc/proftpd.conf
. This Linux server is using vsftpd. So there is a slight change to the solution.Edit the
vsftpd
configuration file and append this to ituse_localtime=YES
. Then restartvsftpd
Here is a more detailed step I did:
su
toroot
Find which
ftpd
it is runnning. For this server it is usingvsftpd
$ ps -ef | grep ftpd
Make a copy of the configuration file.
Use an editor to edit the
vsftpd
configuration file.$ vim /etc/vsftpd/vsftpd.conf
Add the option
use_localtime
and set the value toYES
. The default value isNO
use_localtime=YES
Restart the ftpd service
$ /sbin/service vsftpd restart
$ /sbin/service vsftpd status
Retry login using ftp and check the file timestamp.