I have a *nix system on which I want to get an SFTP chroot set up. Let's say there are three users, users from the same country can read and write the files from their compatriots, but should be chrooted so they cannot access the files from other countries:
Firstly, make a chroot:
$ sudo su -
$ mkdir /chroot
Then create my users, their information is:
alice
group: uk
other group: sftp-user
bob
group: uk
other group: sftp-user
charlie
group: italy
other group: sftp-user
Each of them has been created with the command
useradd -g <group> -G <other group> -d /chroot/<group> -s /sbin/nologin -m <username>
(When bob is made, it'll complain about the home directory already existing, that's okay)
Now I think I need to add details to the /etc/ssh/sshd_config file, but all the examples on the web are for user based chroots, not group ones. My plan is:
#Subsystem stfp /the/old/sftp/subsystem
Subsystem sftp internal-sftp
Match Group sftp-user
ForceCommand internal-sftp
ChrootDirectory %h
Does this seem right? I'm not having any luck!