0


For my user account I explicitly export the TZ variable to be america/chicago in my .bash_profile file, so when I type: date, I get the date in CST. However I have not set the TZ variable for any other user, and when they type: date, they get the date in CST as well, but the output of the command: timedatectl specifically says the timezone is UTC:

[tim etc]timedatectl Warning: Ignoring the TZ variable. Reading the system's time zone setting only.

  Local time: Tue 2018-07-17 18:15:53 UTC   Universal time: Tue 2018-07-17 18:15:53 UTC
    RTC time: Tue 2018-07-17 18:15:52
   Time zone: UTC (UTC, +0000)
 NTP enabled: yes NTP synchronized: yes  RTC in local TZ: no
  DST active: n/a

How is it possible that users who don't have the TZ variable set to america/chicago are getting the america chicago output with the date command:

[tim etc]date Tue Jul 17 13:18:46 CDT 2018

I already checked this as well:
lrwxrwxrwx. 1 root root 25 Mar 23 12:50 localtime -> ../usr/share/zoneinfo/UTC

could it be related to the NTP enabled line? which is also confusing me, since I don't have the ntpd daemon running. This is a aws ec2 machine, if that helps
Thanks!

1 Answer 1

0

A quick search online pointed to a timedatectl utility. It showed my VM lacking the time zone configuration,

$ sudo timedatectl
      Local time: Tue 2018-11-06 17:08:26 UTC
  Universal time: Tue 2018-11-06 17:08:26 UTC
        RTC time: Tue 2018-11-06 17:08:11
       Time zone: Etc/UTC (UTC, +0000)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

I checked the low-level system-wide timezone setting by inspecting the /etc/localtime symbolic link,

$ ls -la /etc/localtime
lrwxrwxrwx. 1 root root 29 Jun 27  2017 /etc/localtime -> ../usr/share/zoneinfo/Etc/UTC

Then I set the time zone and inspected the result,

$ sudo timedatectl set-timezone 'America/Toronto'

$ sudo timedatectl
      Local time: Tue 2018-11-06 12:09:23 EST
  Universal time: Tue 2018-11-06 17:09:23 UTC
        RTC time: Tue 2018-11-06 17:09:07
       Time zone: America/Toronto (EST, -0500)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2018-11-04 01:59:59 EDT
                  Sun 2018-11-04 01:00:00 EST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2019-03-10 01:59:59 EST
                  Sun 2019-03-10 03:00:00 EDT

$ ls -la /etc/localtime
lrwxrwxrwx 1 root root 37 Nov  6 12:09 /etc/localtime -> ../usr/share/zoneinfo/America/Toronto

I guess I may have to reboot to get services aware about the new configuration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .