3

Using dpkg-reconfigure tzdata I have set my timezone to CST, but for non root users the system persists in using UTC time.

pi@raspberry ~ $ date
Wed Oct 28 18:14:08 UTC 2015

root@raspberrypi:/home/pi# date
Wed Oct 28 12:14:08 CST 2015

The problem is also evident in LXPanel Digital Clock and timestamps in Epiphany web pages.

How can I force system time not to use UTC but to use the timezone time I set with tzdata, which is CST?

5
  • 1
    is there any evidence that the non-root user's login scripts are setting TZ themselves? grep TZ ~/.[a-z]* (for example)
    – Jeff Schaller
    Oct 28, 2015 at 19:14
  • 1
    What does echo $TZ say when run as each user?
    – cjm
    Oct 28, 2015 at 19:47
  • 1
    UTC is often a better option for systems, as it doesn't have the stupidity of doubled or eliminated hours thanks to Daylight Saving Time. Are you really sure you need a local timezone that may cause errors or lost data twice per year?
    – thrig
    Oct 28, 2015 at 21:41
  • Have you tried setting the Time Zone in the recommended way i.e. raspi-config?
    – Milliways
    Oct 29, 2015 at 4:34
  • All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.
    – goldilocks
    Oct 31, 2015 at 2:44

2 Answers 2

1

Try with the command: tzconfig

Also check you environmental variables for the non root user: echo $TZ

In case is different to the desired, edit the file where is defined that variable, could be one of these:

$HOME/.bash_profile
$HOME/.profile
$HOME/.bashrc
1

I've just fixed this in RHEL7 for a user who had the UTC time set correctly, but didn't apply the CEST part. The fix was changing the permissions to /etc/localtime from 600 to 644 so that other users apart from root could use it. Therefore, something like:

chmod 0644 /etc/localtime 

should to the trick, if that was your problem.

Here is the relevant article from Redhat:

https://access.redhat.com/solutions/2428001

2
  • 1
    Is that RedHat that sets those 0600 incorrect permissions? Jan 24, 2019 at 17:17
  • I'm not sure, sorry. It's probably a mix of using system tools and editing files manually that doesn't gel properly, but again, not sure
    – pHonta
    Jan 24, 2019 at 17:19

You must log in to answer this question.