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
Seems like a bug, or at least an omission.
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.
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
*** Bug 2733 has been marked as a duplicate of this bug. ***
*** Bug 3422 has been marked as a duplicate of this bug. ***
Closing bugs from openssh-9.1 release cycle