Operating System - HP-UX
1824011 Members
3692 Online
109667 Solutions
New Discussion юеВ

Date Command: Telnet & SSH Differ

 
SOLVED
Go to solution
Karl Balsmeier
Advisor

Date Command: Telnet & SSH Differ

One of the oddest things i've seen in awhile, why does a USER LOGIN under SSH show a different output than under TELNET?

under telnet connect:
$ Tue Mar 25 16:02:34 EST 2003
which is wrong!

under ssh connect:
Tue Mar 25 13:06:59 PST 2003
which is correct

How do I fix/ adjust telnet to give the correct time?

And I thought that date/time were controlled by set_parms timezone, etc/profile, /etc/TIMEZONE and .profile, .login, .cshrc settings...

-karlski
"Unix is the Net"
6 REPLIES 6
Jeff Schussele
Honored Contributor

Re: Date Command: Telnet & SSH Differ

Hi karlski,

As soon as you connect - either way - do

echo $TZ

This is the env parm that controls how time/date will be *displayed*.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Wilfred Chau_1
Respected Contributor

Re: Date Command: Telnet & SSH Differ

check /etc/profile and see what TZ is set to?
Karl Balsmeier
Advisor

Re: Date Command: Telnet & SSH Differ

I have actually checked and corrected all the normal files. What is interesting is that I just logged in as root under telnet and ran the date command, it appears to have fixed the problem.

This appears to be related in some odd way to telnet itself not picking up the timezone adjustments as they are normally done with the typical files/commands. Does anyone know if telnetd caches the time if say, a machine is set to EST and then switches to PST?

-karl
"Unix is the Net"
Patrick Wallek
Honored Contributor

Re: Date Command: Telnet & SSH Differ

The telnet daemon itself has absolutely nothing to do with displaying the date. As said, the date display is controlled by the TZ environment variable. Once the variable is set for a session, it does not change unless you explicitly change it.

The /etc/TIMEZONE, if the file exists, is your default timezone (have a look at /etc/profile). BUT the user can change this in his / her environment by setting TZ in their own .profile, .cshrc, or whatever is appropriate for their shell.

Steven E. Protter
Exalted Contributor
Solution

Re: Date Command: Telnet & SSH Differ

hmmm.

/etc/profile sources for certain when a user telnets in.

ssh. Looks like it sources the file too.

my echo $TZ shows the same value whether I connect via ssh or telnet.

I did this:

env > telnet.env with the telnet session.
env > ssh.env with the ssh login

diff ssh.env telnet.env

[5003#] diff ssh.env telnet.env
4d3
< SSH_TTY=/dev/pts/0
11d9
< USER=root
16d13
< SSH_CLIENT=10.1.11.60 49692 22


So, there should not be differences.

I know this probably isn't helpful but it must be something else.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sorrel G. Jakins
Valued Contributor

Re: Date Command: Telnet & SSH Differ

Someone told me that ssh does NOT run /etc/profile. If that is true, could it be the source of your problem?