Score:0

SFTP only user can't see files in a directory when that directory has read access to public users

br flag

I have a user which I have called username in the below code, in the sshd config file there is this:

Match user username
ChrootDirectory /media/pi/128db83f-859d-48dc-a784-4337c53c736f/username

Match group sftponly
ChrootDirectory /media/pi/128db83f-859d-48dc-a784-4337c53c736f/%u
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

The user is in the group sftponly. I know that the first ChrootDirectory should take effect and the 2nd one ignored for this user.

Within that directory there is a directory called upload, when I log in as this user at a SFTP client and list the files in upload it lists no files, and doesn't give an error, it says success.

But there are files there, the upload directory has 774 for its permissions. Read access for public/other users (which username is) is enabled. The individual files themselves have read access for public/other users.

Why can't username see these files?

jp flag
Show actual permissions for files and directories and UID/GID for the user.
Score:0
br flag

Its ok now, i've got it working.

I added execute permissions for other users:

sudo chmod o+x upload

on the upload directory and now the files in there get listed and can be downloaded.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.