Skip site navigation (1)Skip section navigation (2)
Date:      05 Oct 2003 22:41:48 -0400
From:      Mailing Lists Catcher <freebsd@kibserv.org>
To:        Chuck Swiger <cswiger@mac.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: seperating user timezones from system timezones
Message-ID:  <1065408107.22042.9.camel@butters>
In-Reply-To: <3F805CA8.7010408@mac.com>
References:  <1065316286.850.30.camel@butters>  <3F805CA8.7010408@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2003-10-05 at 14:02, Chuck Swiger wrote:
> Mailing Lists Catcher wrote:
> > How to I allow users access to their own timezone without affecting the
> > system processes?
> > 
> > All of my systems regardless of location have always been set to UTC so
> > logs and cron are in sync across timezones.
> 
> Hmm.  Unix has understood the notion of 'local time' versus UTC and most 
> programs do the right thing even if you set the timezone for the entire 
> system-- things like ntpd will syncronize via UTC even if TZ was set in their 
> environment.
> 
> If you want to run syslogd and cron in UTC, I believe you could do so by 
> setting something like this in /etc/rc.conf:
> 
> cron_program='/usr/bin/env TZ=UTC /usr/sbin/cron'
> syslogd_program='/usr/bin/env TZ=UTC /usr/sbin/syslogd'
> 
This I will try.

> > Recently I have had need to allow users to set their own timezone in the
> > .cshrc using:
> > sentenv TZ America/Detroit
> > or
> > sentenv TZ America/Denver
> > or whatever applies.
> 
> Of course, you meant 'setenv' and not 'sentenv'.
> 
yes...typo on my part. I did use setenv in the file....anything else
wouldnt have any affect.

> > But what I am finding out is that as long as the user is logged in it
> > sets the environment for the entire system affecting log timestamps as
> > well as cron events.
> 
> Unless you set TZ in /etc/profile, it should not have a universal effect.  Are 
> you sure you didn't kill and restart syslogd as root with TZ configured to a 
> non-UTC timezone?

Apparently it only affects my log files.  A bit of testing proved that
it does not seem to affect cron or syslog.  Root user has no TZ set as
root doesn't use X or any calendar or time based applications.

But it is clear that log entries are timestamped by the user who is
logged in at the time.  But from what I can see only logs created by
actions of that user get the users local timezone in the log file.

So I guess my only problem is a few strangly timestamped entries in my
log file.  My system doesnt generate much in the way of logs on its own
so its uncertain if a user logged in really affects a log entry not
generated by a user action.  If not then I guess I can live with a few
log anomalies.  But Bad SU to Root messages would be nice to have in UTC
and not the user's TZ that tried the SU.  I would hate to have to lookup
the TZ of the user each time I needed to know want a bad SU happened.
> 
> Maybe try setting TZ only if the shell is interactive, by adding the setenv 
> after the line "if ($?prompt) then"...?

I will also give this a try

Thanks

Jason Cribbins




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1065408107.22042.9.camel>