Created attachment 2182 [details] Patch which implements the functionality described above. When chrooting users it can be useful to be able to use a user's group name as a parameter when constructing the chroot directory path for a user. The code already supports parameter expansion for the user name (%u) and home directory (%h). So, this can be implemented by a fairly simple extension of the existing code. I have attached a patch which adds the parameter %g which expands to the user's group name if used in a ChrootDirectory configuration line in sshd_config. E.g. ChrootDirectory /opt/domains/%g If user foo with group bar connects via ssh then they will be chroot'd to /opt/domains/bar TODO: update the man page