System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

SSH & Telnet time zone problem

 
SOLVED
Go to solution
Highlighted
Advisor

SSH & Telnet time zone problem

Hi,

I have HP-UX 11.31 with strange problem:
When i telnet to this machine and run "date" i get the correct time zone i defined, but with ssh the time zone is different.

Any idea?

Thanks,
Tal
5 REPLIES 5
Highlighted
Honored Contributor
Solution

Re: SSH & Telnet time zone problem

Perhaps when the currently-running sshd daemon was started, the system default timezone was set differently. If the sshd daemon was not restarted after changing the system timezone, all the sessions started through it will still inherit the old timezone setting.

(One of the main reasons for the recommendation to reboot the system after changing fundamental system settings like hostname, IP address(es) and timezone, is to avoid situations like this.)

Quick fix: login to the system and become root.
Make sure your session's current timezone setting is correct. If it isn't, set the TZ environment variable to the correct system default timezone by running this command:

. /etc/TIMEZONE

Then stop and restart sshd:

sh /sbin/init.d/secsh stop
sh /sbin/init.d/secsh start

If this does not help, read the sshd start-up script (/sbin/init.d/secsh in the case of HP Secure Shell) to make sure someone hasn't added extra commands to override the TZ value for sshd.

MK
MK
Highlighted
Valued Contributor

Re: SSH & Telnet time zone problem

You also need to be aware that many ssh implementations allow for setting up it's own environment. The sshd_config controls from the host end and normally blocks custom user settings, but check PermitUserEnvironment to be sure. If a user environment is allowed, check in ~/.ssh for an environment file.
Highlighted
Acclaimed Contributor

Re: SSH & Telnet time zone problem

>When I telnet to this machine and run "date" I get the correct time zone I defined, but with ssh the time zone is different.

Have you defined TZ in your .profile?
Highlighted
Advisor

Re: SSH & Telnet time zone problem

Hi everyone,

I tried all the above with no results.
Finally, I run the "set_parms timezone" (same as after fresh install) and the problem solved!

Thanks for all the efforts,
Tal
Highlighted
Advisor

Re: SSH & Telnet time zone problem

"set_parms timezone" solved the problem.