Re: ls of ftp and system ls show diffent timestamp (631 Views)
Reply
Frequent Advisor
jasonK_1
Posts: 70
Registered: ‎12-12-2003
Message 1 of 5 (675 Views)

ls of ftp and system ls show diffent timestamp

[ Edited ]

ls of ftp and system ls show diffent timestamp

Basically ls of ftp show the UTC timestamp, whereas the ls of the server show PST time.  I have the /etc/TIMEZONE in the PST format and my /etc/profile also read from /etc/TIMEZONE then why the javaapplet and ftp (firefox, filezilla, reflection web) show files in UTC timestamp? I want them to show in the PST zone.  

Thanks,
Jason


#uname -a
HP-UX hpsrv1 B.11.11 U 9000/800 587730578 unlimited-user license

# date -u
Tue Feb 14 00:13:29 UTC 2012

#date

Mon Feb 13 16:13:44 PST 2012

# cat /etc/TIMEZONE
TZ=PST8PDT
export TZ


 #echo $TZ

PST8PDT

Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,084
Registered: ‎02-23-2005
Message 2 of 5 (656 Views)

Re: ls of ftp and system ls show diffent timestamp

> Basically [...]

   As usual, showing actual commands with their actual output can be
more helpful than vague descriptions or interpretations.

> [...] ls of ftp show the UTC timestamp, [...]

   Are you talking about the date-time values shown in a DIR/LIST
listing produced by the FTP server (which?) on your HP-UX system?

> [...] and my /etc/profile also read from /etc/TIMEZONE then why the
> javaapplet and ftp (firefox, filezilla, reflection web) show files in
> UTC timestamp?

   FTP clients tend to show the data sent by the FTP server.

>  #echo $TZ
> PST8PDT

   The FTP server process probably cares more about what's in _its_
environment than it does about what's in _your_ environment.

   I don't know where the FTP server gets its environment, and I haven't
tried this, so I know nothing, but if I wished to control its
environment, I'd probably start by writing a shell script which sets the
environment variables as I wished, and then runs the FTP server program.
Then, I'd replace the original FTP server command ("/usr/bin/ftpd ..."?)
in my inetd configuration file ("/etc/inetd.conf"?) with a similar
command which specifies my new script, instead.  (Naturally, the script
should pass its command-line arguments along to the actual FTP server
program.)

Please use plain text.
Frequent Advisor
Nighwish
Posts: 45
Registered: ‎06-27-2011
Message 3 of 5 (649 Views)

Re: ls of ftp and system ls show diffent timestamp

Hi

 

 

Just a check ftp is a insecure service. Try sftp you must configure ssh keys it's easy and secure.

 

 

Regards.

Please use plain text.
Honored Contributor
Bill Hassell
Posts: 14,204
Registered: ‎05-29-2000
Message 4 of 5 (639 Views)

Re: ls of ftp and system ls show diffent timestamp

[ Edited ]

The ftpd daemon is run by inetd so the timezone (variable TZ) for ftpd is the one used to start inetd. inetd is started during the rc script sequence.  /etc/TIMEZONE is called as part of the environment  setup (/sbin/rc, /etc/rc.config and auto_parms). Something prior to inetd startup may have unset TZ or assigned it the UTC value. If you don't want to troubleshoot the startup scripts, just add the line:

 

. /etc/TIMEZONE

 at the beginnng of the /sbin/init.d/inetd script. Note carefully: there is a period, then space, then the TIMEZONE filename. This is called sourcing the file and will set TZ before inetd starts.

 

Once you change the /sbin/init.d/inetd script, restart inetd like this:

 

/sbin/init.d/inetd stop
/sbin/init.d/inetd start

 And now your ftp listings will be shown in the current /etc/TIMEZONE value.

 

Please use plain text.
Frequent Advisor
jasonK_1
Posts: 70
Registered: ‎12-12-2003
Message 5 of 5 (631 Views)

Re: ls of ftp and system ls show diffent timestamp

Thanks Bill. You nailed it.  Now I need to debug the script to find out why and where!

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation