Bug 3465 - sftp shows owner id and group id instead of name.
Summary: sftp shows owner id and group id instead of name.
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: 8.1p1
Hardware: PPC AIX
: P5 normal
Assignee: Assigned to nobody
URL:
Keywords:
: 2733 3422 (view as bug list)
Depends on:
Blocks: V_9_1
  Show dependency treegraph
 
Reported: 2022-07-30 01:42 AEST by Mayank
Modified: 2022-10-04 21:58 AEDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mayank 2022-07-30 01:42:50 AEST
Hi

While invoking sftp session, if I ran ls -l command, its shows everything properly (file owner name and its group name), but when I tried to display a specific file, say ls -l file1 , in such case, it used to display file owner id and its group id, as shown below -

# sftp localhost
Connected to localhost.
sftp> cd home/mayank
sftp> ls -l
-rw-r--r--    1 mayank   staff           0 Jul 29 10:37 file1
-rw-r--r--    1 mayank   staff           0 Jul 29 10:37 file2
-rw-r--r--    1 mayank   staff           0 Jul 29 10:37 file3
sftp> ls -l file1
-rw-r--r--    ? 210      1               0 Jul 29 10:37 file1
sftp>


Just want to know if its as per design or its a bug.

Thanks 
Mayank
Comment 1 Darren Tucker 2022-09-09 13:34:55 AEST
Seems like a bug, or at least an omission.
Comment 2 Thomas Wolf 2022-09-26 07:48:18 AEST
ls -l does an SFTP directory listing and prints the SFTP longnames.

ls -l file1 (or also ls -l file*) go through the glob machinery and drop the longname info.
Comment 3 Damien Miller 2022-09-27 17:00:12 AEST
Fixed in OpenSSH HEAD and will be in the openssh-9.1 release due within days.

Note that this uses a protocol extension and requires both the client and server to be updated.

---

commit 9d952529113831fb3071ab6e408d2726fd72e771
Author: djm@openbsd.org <djm@openbsd.org>
Date:   Mon Sep 19 10:46:00 2022 +0000

    upstream: use users-groups-by-id@openssh.com sftp-server extension
    
    (when available) to fill in user/group names for directory listings.
    Implement a client-side cache of see uid/gid=>user/group names. ok markus@
    
    OpenBSD-Commit-ID: f239aeeadfa925a37ceee36ee8b256b8ccf4466e

commit 8ff680368b0bccf88ae85d4c99de69387fbad7a6
Author: djm@openbsd.org <djm@openbsd.org>
Date:   Mon Sep 19 10:43:12 2022 +0000

    upstream: sftp client library support for
    
    users-groups-by-id@openssh.com; ok markus@
    
    OpenBSD-Commit-ID: ddb2f33a2da6349a9a89a8b5bcb9ca7c999394de

commit 488f6e1c582212c2374a4bf8cd1b703d2e70fb8b
Author: djm@openbsd.org <djm@openbsd.org>
Date:   Mon Sep 19 10:41:58 2022 +0000

    upstream: extend sftp-common.c:extend ls_file() to support supplied
    
    user/group names; ok markus@
    
    OpenBSD-Commit-ID: c70c70498b1fdcf158531117e405b6245863bfb0

commit 74b77f7497dba3a58315c8f308883de448078057
Author: djm@openbsd.org <djm@openbsd.org>
Date:   Mon Sep 19 10:40:52 2022 +0000

    upstream: sftp-server(8): add a "users-groups-by-id@openssh.com"
    
    extension request that allows the client to obtain user/group names that
    correspond to a set of uids/gids.
    
    Will be used to make directory listings more useful and consistent
    in sftp(1).
    
    ok markus@
    
    OpenBSD-Commit-ID: 7ebabde0bcb95ef949c4840fe89e697e30df47d3
Comment 4 Damien Miller 2022-09-28 12:06:52 AEST
*** Bug 2733 has been marked as a duplicate of this bug. ***
Comment 5 Damien Miller 2022-09-28 12:07:38 AEST
*** Bug 3422 has been marked as a duplicate of this bug. ***
Comment 6 Damien Miller 2022-10-04 21:58:59 AEDT
Closing bugs from openssh-9.1 release cycle