0

I've setup a chroot jail for some users and that is running fine.

I want them to be able to use the df command (I'm using a modified etc/mtab file inside their chroot with just "/" specified) but I dont want them to be able to see the full usage stats of the disk that they're using.

Ideally it would just show their usage but really anything as long as it is generic would be fine.

Does anyone have any ideas?

1
  • I'm not sure, but probably grsecurity patches have such option.
    – neutrinus
    Apr 7, 2014 at 5:19

2 Answers 2

2

One of options is to enable disk quota for jailed users
and main idea just replace df with wrapper script

Disk Quota setup

After you may use quota -u juser1 to get information about space per user,
this information can be used in some wrapper script, which you place in jail under df name

1

I think the only option is to use a separate file system for the chroot.

  1. Create a new file system on a partition or a file.
  2. Mount the new file system somewhere (using loopback if it is in a file).
  3. Move files from the chroot into the new file system.
  4. Mount the new file system in the final location.

You can make the file sparse, which will keep the disk space consumption down at first. But nothing stops it growing, and the result won't be pretty if there is not enough space to grow it. So it might be best not to make it sparse.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .