Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

  group: uk
  other group: sftp-user    

  group: uk
  other group: sftp-user

  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!

share|improve this question
I tried to use something similar on Enterprise Linux 6, but I had no luck. The OpenSSH from it was probably too old. – Cristian Ciupitu Oct 22 '13 at 19:04

You must log in to answer this question.

Browse other questions tagged .