Why does “date” show different times in root and user?












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?










share|improve this question















migrated from raspberrypi.stackexchange.com Oct 28 '15 at 18:59


This question came from our site for users and developers of hardware and software for Raspberry Pi.














  • 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 '15 at 19:14






  • 1





    What does echo $TZ say when run as each user?

    – cjm
    Oct 28 '15 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 '15 at 21:41











  • Have you tried setting the Time Zone in the recommended way i.e. raspi-config?

    – Milliways
    Oct 29 '15 at 4:34











  • All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.

    – goldilocks
    Oct 31 '15 at 2:44
















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?










share|improve this question















migrated from raspberrypi.stackexchange.com Oct 28 '15 at 18:59


This question came from our site for users and developers of hardware and software for Raspberry Pi.














  • 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 '15 at 19:14






  • 1





    What does echo $TZ say when run as each user?

    – cjm
    Oct 28 '15 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 '15 at 21:41











  • Have you tried setting the Time Zone in the recommended way i.e. raspi-config?

    – Milliways
    Oct 29 '15 at 4:34











  • All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.

    – goldilocks
    Oct 31 '15 at 2:44














3












3








3


1






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?










share|improve this question
















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?







debian date raspbian timezone






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 28 '15 at 19:00









goldilocks

62k14151209




62k14151209










asked Oct 28 '15 at 18:40







Peter Strong











migrated from raspberrypi.stackexchange.com Oct 28 '15 at 18:59


This question came from our site for users and developers of hardware and software for Raspberry Pi.









migrated from raspberrypi.stackexchange.com Oct 28 '15 at 18:59


This question came from our site for users and developers of hardware and software for Raspberry Pi.










  • 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 '15 at 19:14






  • 1





    What does echo $TZ say when run as each user?

    – cjm
    Oct 28 '15 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 '15 at 21:41











  • Have you tried setting the Time Zone in the recommended way i.e. raspi-config?

    – Milliways
    Oct 29 '15 at 4:34











  • All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.

    – goldilocks
    Oct 31 '15 at 2:44














  • 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 '15 at 19:14






  • 1





    What does echo $TZ say when run as each user?

    – cjm
    Oct 28 '15 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 '15 at 21:41











  • Have you tried setting the Time Zone in the recommended way i.e. raspi-config?

    – Milliways
    Oct 29 '15 at 4:34











  • All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.

    – goldilocks
    Oct 31 '15 at 2:44








1




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 '15 at 19:14





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 '15 at 19:14




1




1





What does echo $TZ say when run as each user?

– cjm
Oct 28 '15 at 19:47





What does echo $TZ say when run as each user?

– cjm
Oct 28 '15 at 19:47




1




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 '15 at 21:41





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 '15 at 21:41













Have you tried setting the Time Zone in the recommended way i.e. raspi-config?

– Milliways
Oct 29 '15 at 4:34





Have you tried setting the Time Zone in the recommended way i.e. raspi-config?

– Milliways
Oct 29 '15 at 4:34













All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.

– goldilocks
Oct 31 '15 at 2:44





All raspi-config does is run dpkg-reconfigure locales and dpkg-reconfigure tzdata.

– goldilocks
Oct 31 '15 at 2:44










2 Answers
2






active

oldest

votes


















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





share|improve this answer































    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






    share|improve this answer





















    • 1





      Is that RedHat that sets those 0600 incorrect permissions?

      – Stéphane Chazelas
      Jan 24 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 at 17:19











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f239294%2fwhy-does-date-show-different-times-in-root-and-user%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown
























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    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





    share|improve this answer




























      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





      share|improve this answer


























        1












        1








        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





        share|improve this answer













        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






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 28 '15 at 21:53









        alanbaloalanbalo

        761




        761

























            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






            share|improve this answer





















            • 1





              Is that RedHat that sets those 0600 incorrect permissions?

              – Stéphane Chazelas
              Jan 24 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 at 17:19
















            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






            share|improve this answer





















            • 1





              Is that RedHat that sets those 0600 incorrect permissions?

              – Stéphane Chazelas
              Jan 24 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 at 17:19














            1












            1








            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






            share|improve this answer















            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







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 24 at 17:14

























            answered Oct 9 '18 at 7:33









            pHontapHonta

            1113




            1113








            • 1





              Is that RedHat that sets those 0600 incorrect permissions?

              – Stéphane Chazelas
              Jan 24 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 at 17:19














            • 1





              Is that RedHat that sets those 0600 incorrect permissions?

              – Stéphane Chazelas
              Jan 24 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 at 17:19








            1




            1





            Is that RedHat that sets those 0600 incorrect permissions?

            – Stéphane Chazelas
            Jan 24 at 17:17





            Is that RedHat that sets those 0600 incorrect permissions?

            – Stéphane Chazelas
            Jan 24 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 at 17:19





            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 at 17:19


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f239294%2fwhy-does-date-show-different-times-in-root-and-user%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?