I have a machine running Ubuntu 12.04 LTS with OpenSSH server installed. I have created a user with a jailed home account.

When I log in with the user's account, I can only access his home (duh).

In addition to the user's home folder, I would like to give the him read access to a particular partition (/Volumes/Storage). How can I do this?


You will need to ensure that the chroot that the users is put in has access to the directory by bind mounting into the chroot tree:

mount --bind /Volumes/Storage /path/to/chroot

The user will also need to have necessary filesystem permissions to read the data on the drive. The easiest way to accomplish this would be to put the user in a supplementary group that has ownership of the files (assuming standard 755 and 644 permissions).

  • The /path/to/chroot is that the user his home directory? In my sshd_config file I set: ChrootDirectory %h – Vincent Sep 4 '12 at 15:43
  • @user21670 - No, its the root of the chroot. It can be anywhere inside of the chroot, including the user's home directory. – jordanm Sep 4 '12 at 15:47
  • and how do I unbind? never mind: I was able to do it using umount – Vincent Sep 4 '12 at 15:51
  • To make this permanent (i.e. so it will work after reboot), add the following line to /etc/fstab: /Volumes/Storage /path/to/chroot none bind 0 0 – tjanez Jul 9 '15 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.