开发者

ubuntu postfix timezone change

I met this weird problem, and I tried a whole afternoon to solve this, with all the methods I found from google, but till now, nothing seems to be worked.

My ubuntu server's (10.04 LTS) timezone is Europe/Helsinki, it's correct (when I run "date" command, the result shows the right time). But my postfix seems still using UTC timezone, because all the time in开发者_如何学Python /var/log/mail.log is 3 hours earlier than my current time.

I've also copied the /etc/localtime to /var/spool/postfix/etc/localtime, but nothing helps. (cp /usr/share/zoneinfo/Europe/Helsinki /var/spool/postfix/etc/localtim also not work).

I also tried to run dpkg-reconfigure tzdata, also not work, system time always correct, but only mail.log got wrong.

Could anyone give me some suggestion ?

*I have restarted postfix everytime I tried to make some change.


Copying the timezone (/etc/localtime) into Postfix's chroot should do the trick, but there are a couple assumptions:

  1. Is your /etc/timezone file set correctly as well? It should probably only contain the line Europe/Helsink. (Note that you can probably set all the timezone stuff correctly with the command sudo dpkg-reconfigure tzdata.)

  2. If Postfix is using syslogd for logging, then that may be what is recording logs in UTC. You might consider changing to syslogd-ng (or similar) which supports multiple timezones.

  3. Are you sure that /var/spool/postfix is the chroot that Postfix is using? If that isn't the root of your Postfix jail, there probably won't be all the other config files there.; you can look for the chroot option in the master.cf file, or here's another way to check. In any case, you want the /etc/localtime file in the etc folder that Postfix is using.

  4. Just in case, be sure that it is a "real" timezone file you're copying in, not a symbolic link (from ln -s targetfilename linkfilename). You can use the command file /etc/localtime to test; if it tells you it's timezone data, go ahead and copy it to Postfix's chroot; if it tells you it's a symlink, then you want to copy the original /usr/share/zoneinfo/Europe/Helsinki.


After you changing your timezone, you should restart your syslogd with:

 sudo service rsyslog restart

Because postfix usually use syslogd for logging.


Not exactly ubuntu but because this question is in the top of the search results: For me the problem was in rsyslog timezone. To fix:

vim /etc/sysconfig/clock 
ZONE="America/New_York"     # or your timezone, of course
systemctl restart rsyslog
#  or
/etc/init.d/rsyslog restart

Then restart postfix.

Thanks to this post

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜