Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
I'm not sure, but probably grsecurity patches have such option. –  neutrinus Apr 7 at 5:19

2 Answers 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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

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

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