Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.