Operating System - HP-UX
1825766 Members
2221 Online
109687 Solutions
New Discussion

system date gets changed as per user

 
SOLVED
Go to solution
jagdeesh
Frequent Advisor

system date gets changed as per user

Hi,
On my unix server system time gets changed. when i login As root, it shows correct times as
Sat Feb 14 15:41:58 IST 2004,
when i login as oracle or other user it shows
Sat Feb 14 04:57:21 EST 2004

What could be the reason ? how can i change it the same to IST time..
16 REPLIES 16
Robert-Jan Goossens
Honored Contributor

Re: system date gets changed as per user

Hi,

The users timezone is set the /etc/profile (global settings) if the oracle timezone differs from the global timezone, oracle $home/.profile has probably got an other timezone set.

Hope this helps,
Robert-Jan



jagdeesh
Frequent Advisor

Re: system date gets changed as per user

not only oracle user , all users except root i'm facing the problem

ex:
nbkp|/ub00/oracle>id
uid=501(oracle) gid=101(dba)
nbkp|/ub00/oracle>date
Sat Feb 14 06:55:46 EST 2004
nbkp|/ub00/oracle>exit
logout
#
#
# id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
# date
Sat Feb 14 17:26:16 IST 2004
#

Robert-Jan Goossens
Honored Contributor

Re: system date gets changed as per user

Ok,

Check the file /etc/TIMZONE ?

What is in it ?

Robert-Jan
Paula J Frazer-Campbell
Honored Contributor

Re: system date gets changed as per user

Hi
Roots profiles is differnt to user profiles check which profile they are using and set correct Timezone.


Paula
If you can spell SysAdmin then you is one - anon
Robert-Jan Goossens
Honored Contributor

Re: system date gets changed as per user

Uhh Typo,

Check the file /etc/TIMEZONE ?

What is in it ?

Robert-Jan
Michael Schulte zur Sur
Honored Contributor

Re: system date gets changed as per user

Hi,

can you post a .profile of one of these users?

Michael
jagdeesh
Frequent Advisor

Re: system date gets changed as per user

nbkp|/home/sysadm>id
uid=137(hpsysdba) gid=20(users)
$cat .profile
# @(#) $Revision: 72.2 $

# Default user .profile file (/usr/bin/sh initialization).

# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs

# Set up the search paths:
PATH=$PATH:.:/usr/sbin
export PATH

# Set up the shell environment:
set -u
trap "echo 'logout'" 0
# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR


PS1='$hn|$PWD>';export PS1
umask 027

**********************************************
nbkp|/etc>ll TIMEZONE
-r--r--r-- 1 bin bin 22 Feb 14 05:59 TIMEZONE
nbkp|/etc>pg TIMEZONE
TZ=IST-5:30
export TZ
(EOF):
.......
Robert-Jan Goossens
Honored Contributor

Re: system date gets changed as per user

Hi again,

So the /etc/TIMEZONE is correct. check the /etc/profile for the lines simular to below example.

# Set the TIMEZONE

if [ -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE
else

TZ=MST7MDT # change this for local time
export TZ
fi

and check root's /.profile for the same.

Robert-Jan
jagdeesh
Frequent Advisor

Re: system date gets changed as per user

Hi,
# Set the TIMEZONE

if [ -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE
else
TZ=MST7MDT # change this for local time.
export TZ
fi

/etc/profile is proper as shown..
T G Manikandan
Honored Contributor
Solution

Re: system date gets changed as per user

If you have the TZ defined in the /etc/profile make sure that the file is world readable.i.e r--r--r-- /etc/profile.


if the timezone is defined there are users are unable to read it then it would be a problem.

/etc/profile should be referenced by sh,ksh users.If you are having users with csh then also make sure that /etc/csh.login has a definition to that
Bill Hassell
Honored Contributor

Re: system date gets changed as per user

TZ is different in root which you can see from the date command. It is IST for root but EST for other users. The simplest way find where it is not handled correctly is to grep TZ in the login profiles for the users. For sh, ksh users, /etc/profile is followed by .profile in the user's $HOME directory. For csh users, /etc/csh.login is followed by .cshrc in $HOMNE. Note that other files may be sourced (.kshrc .login etc) depending on options.

This should find where TZ is set:

grep TZ /etc/profile /etc/csh.login
cd ~user-name
grep TZ .profile .login

Be sure to cd to root and also to a couple of users. If TZ is only set in /etc/profile and /etc/csh.login, then someone has changed the permissions for /etc/TIMEZONE have been altered (not good). Verify this by logging in as a normal user and type the command:

. /etc/TIMEZONE

If you get permission denied, someone with the root password has changed the permissions. /etc/TIMEZONE should be 444 permission (read for everytone).


Bill Hassell, sysadmin
Sathish C
Frequent Advisor

Re: system date gets changed as per user

Hi
TZ variable cal also be set for individual user with their profiles . Either you can scan the system and get rid off the TZ setting if any on the individual user profiles or set one globally .Ofcourse pls determine what your country TZ should be .


Ex => export TZ=SAST-2
Some cause happiness wherever they go; others, whenever they go
Elmar P. Kolkman
Honored Contributor

Re: system date gets changed as per user

Check to see if users, other then root, can access /etc/TIMEZONE. It contains the right information but for some reason is not used by the users... What you can do to test is, as a normal user:
$ . /etc/TIMEZONE
$ date

If that doesn't work, you might check rights on /etc itself...

If it does work, start looking for run scripts related to shells. Those are called .bashrc or .kshrc, depending on the shell they use.

But there is one other thing that beats me: if /etc/TIMEZONE is not readable, the default TIMEZONE would be MDT or MST, not EST. So it seems somewhere the TIMEZONE variable is overruled. But I'm missing parts of your .profile, because I see no definition of the 'hn' enviroronment variable, used in your prompt, so maybe the place where that gets set is also the place where TIMEZONE is overruled...
Every problem has at least one solution. Only some solutions are harder to find.
Michael Schulte zur Sur
Honored Contributor

Re: system date gets changed as per user

Hi,

does anyone work with CDE or is there any other login, where /etc/profile isn't used?

Michael
Bill Hassell
Honored Contributor

Re: system date gets changed as per user

Unfortunately, Xwindows seems to assume that you would NEVER want to login with a character mode window. With all that GUI power, the only reason to use Xwindows is to run graphics drawing programs. 8-(

So the default is never to run a 'normal' profile at login when using CDE or VUE. However, there are two easy fixes:

1. Don't use CDE or VUE, especially when running it on a non-Xwindows machine like a PC. Use a local telnet or ssh client such as WRQ's Reflection terminal (not Reflection/X) product, QCterm (freebie but no ssh) or similar.

2. Create .Xdefaults in the $HOME directory where you login. You can include all sorts of decoration information but the most important is the loginShell details:

*loginShell: true
HPterm*background: navy
HPterm*foreground: white
HPterm*saveLines: 10s
HPterm*scrollBar: true

Xterm*background: darkslateblue
Xterm*foreground: white
Xterm*saveLines: 10s
Xterm*scrollBar: true

Dtterm*saveLines: 10s
Dtterm*scrollBar: true

This file (.Xdefaults) must be stored in the machine where you run CDE or VUE. As you start CDE or VUE (or simply start hpterm, xterm or dtterm), they will inherit these settings as appropriate. You'll see some references to .dtprofile and a resource setting DTSOURCEPROFILE=true. Unfortunately, this is an incomplete solution (never runs /etc/profile) so don't bother with .dtprofile.


Bill Hassell, sysadmin
Michael Schulte zur Sur
Honored Contributor

Re: system date gets changed as per user

Hi,

does ln /etc/profile /etc/dt/config/Xsession.d/profile
chmod +rx /etc/dt/config/Xsession.d/profile
change anything?

Michael