Search code examples
linuxraspberry-pisftpraspbian

restricting sftp users to home directory and allowing access


I've followed this procedure to only allow sftp access to the sftp group

Restricting SFTP user to home directory

for this to work the home directory of the user has to be root owned. How can can enable this so the user can delete and upload files to this area when sftp'd in? I've tried keeping the owner of the home folder as root:root and changed all the permissions to files below to user:sftp but that doesnt work.


Solution

  • Deleting and creating files in a directory depends on the write permission to this directory. So you will have to create subdirectories owned by the sftp-user inside his home were this user is able to write. There are some workarounds to this, but all of them have their side effects.