[PATCH] Chroot file manager for Virtualmin Users

4 posts / 0 new
Last post
#1 Fri, 10/27/2006 - 21:56
EvanWaite

[PATCH] Chroot file manager for Virtualmin Users

Hi there,

Due to some locked down file permissions on my hosting server (711 on / and /home), the default "File Manager (home directory only)" setting produces a couple error messages because it tries to display the users home folder starting from / in a tree. The Webmin file manager already has a "Chroot directory for entire file manager" option so I've made a small change to feature-webmin.pl that chroot's the file manager to the user's home folder (and avoids the error). This is similar to how I have the ftp server configured (chroot to home) so it also provides a more consistent interface. Below is a patch for the current version of Virtualmin GPL (3.26) in case anyone is interested in it. I think it would also make a nice option in future versions (hence the posting in this forum rather than hacks).

--- feature-webmin.pl.orig 2006-10-19 10:55:53.000000000 -0600 +++ feature-webmin.pl 2006-10-27 20:36:36.000000000 -0600 @@ -428,7 +428,8 @@ if ($extramods{'file'} && $[[0]]->{'unix' local %acl = ( 'noconfig' => 1, 'uid' => $[[0]]->{'uid'}, 'follow' => 0, - 'root' => $[[0]]->{'home'}, + 'chroot' => $[[0]]->{'home'}, + 'root' => '/', 'home' => 0, 'goto' => 1 ); &save_module_acl_logged(%acl, $_[[1]]->{'name'}, "file")

Fri, 10/27/2006 - 22:03
EvanWaite

Hmm, the formatting on that patch got a bit messed up :)

Here's a link to the actual patch.

http://www.edwconsulting.com/virtualmin/patches/virtualmin-3.26-feature-...

Sun, 11/05/2006 - 13:14
Joe
Joe's picture

Hi Evan,
Actually, the file manager is supposed to be able to automatically handle this case already, as it was mentioned to me many years ago before Virtualmin was developed.

What error messages are you seeing exactly?

The chroot solution will work, but I usually try to avoid it as it breaks some functions of the file manager, like un-compressing file archives, as the unzip and zip commands are not in the chroot.

--

Check out the forum guidelines!

Sun, 11/05/2006 - 19:49
EvanWaite

Hi Jamie,

Here are a couple screenshots of the problem when I don't chroot the user. This is when logged into webmin (1.300) as the domain owner and using the file manager (error messages as soon as the java applet loads).

Error window only:
http://www.edwconsulting.com/virtualmin/images/webmin-file-manager-non-c...

Full screenshot showing applet with all three error windows:
http://www.edwconsulting.com/virtualmin/images/webmin-file-manager-non-c...

Here are the permissions on the folders leading down to the users home.

drwx--x--x root root /
drwx--x--x root root /home/
drwxr-x--- testdomain testdomain /home/testdomain/

Let me know if you need any additional information.

-Evan

Topic locked