I try to setup virtual users for sftp with sshd and/or pam.
My folder structure looks like this:
/ |-- var | +-- www | +-- site1 | +-- folder_1 | +-- folder_2 | +-- site2 | +-- folder_1 | +-- folder_2
Each site dose have a Linux user (e.g. site1, site2) with the same group (site1, site2) where the home directory is e.g.
/var/www/site1. The umask is 0022 and all files and (sub)folders for e.g.
GID=site1 and this should not be changed.
I was able to setup sshd so that each Linux user gets his home directory as sftp root folder is e.g.
/var/www/site1 for user
site1. The config in
/etc/ssh/sshd_config looks something like this
(only last few lines, the rest is default configuration):
UsePAM yes Subsystem sftp internal-sftp Match User *,!root ChrootDirectory %h ForceCommand internal-sftp -u 0022 AllowTcpForwarding no
Now I want to add a Virtual User (no new Linux user or group if not needed) where the sftp root folder is e.g.
/var/www/site1/folder1 for a sftp user e.g.
site1_folder1. This user should be a child of the user
site1 and use the same UID and GID but only have access to his subdirectory.
How do I have to change my configuration, and where can I add Virtual User?
I need this on Ubuntu 16.04 LTS, LAMP Server