Bug 3021

Summary: Openssh/sftp question related to timezone difference with "ls -l"
Product: Portable OpenSSH Reporter: Sebastian Woell <sebastian.woell>
Component: sftpAssignee: Assigned to nobody <unassigned-bugs>
Status: NEW ---    
Severity: trivial    
Priority: P5    
Version: 7.7p1   
Hardware: Other   
OS: Linux   

Description Sebastian Woell 2019-06-20 00:49:56 AEST
Hi team,

I am experiencing some strange behaviour when I run an “ls -l” in an sftp session (both server and client are openssh) – and I am wondering if the behaviour is a feature or a bug.

The issue occurs if server time zone differs from client time zone. And I have also tested this with different combinations of openssh server and client versions on different operating systems (AIX, Linux and Solaris) – the issue always exists.

The issue is the following:
When I run an “ls –l” in a dir, the timestamp of the files in the dir are shown in server (remote) time zone. But if I run the “ls –l “ for a specific file, the time is shown in client time zone.

Sample log of the connection:

Client: Openssh version 7.70.11.0, AIX 7.1, Timezone Europe/Berlin
Server: Openssh version 7.50.14.0, RHEL 7.4, Timezone Asia/Singapore

sftp> ls -l
-rwxr-xr-x    1 root     system       1267 Jun 19 15:05 test.sh
sftp> ls -l test.sh
-rwxr-xr-x    ? 0        0            1267 Jun 19 21:05 test.sh

What I also see is that in the “ls –l <filename>” version, the owner and group are also no longer shown as names.
Is there anyone that can explain this to me?

Thanks,
Sebastian