Bug in chroot environment

Discussion in 'General' started by PacketPaul, Oct 5, 2007.

  1. PacketPaul

    PacketPaul New Member

    I have created two users, Sam and Alfred with Alfred being the administrator. The home directories in the passwd file are set as follows:


    Notice the home directory for Alfred is the root directory of the entire site and not the more logical /var/www/web5/./user/web5_alfred.

    Why is this important? Because Dovecot looks for the Maildir in the home directory (i.e. ~/Maildir). Thus Dovecot can not find the administrators e-mail which is being stored at /var/www/web5/user/web5_alfred/Maildir.

    While I realize I can write a script that Dovecot will call to set the e-mail directory based upon if the user is an administrator, for simplicity, all e-mail should be stored in a similar location. The fix is quite simple, the home directory in the passwd file needs to be changed from:

    /var/www/web5/./ to /var/www/web5/./users/web5_alfred

    Second issue:
    Is it really necessary to give sam his own chroot environment? That seems like a waste of space. I imagine most people would find it acceptable that all users are chrooted to the root directory of the site.

    Take care,

  2. PacketPaul

    PacketPaul New Member

    Ok, this the the modifications required. All are in config.lib.php:

    Around line 632, delete the following:

    $mod->system->adduser($user_username, $userid, $gid_web, $user_name, $web_path.$chroot_addpath, $shell, $passwort);
    } else {
    $mod->system->adduser($user_username, $userid, $gid_web, $user_name, $web_path."/user/".$user_username.$chroot_addpath, $shell, $passwort);

    Replace with:

    $mod->system->adduser($user_username, $userid, $gid_web, $user_name, $web_path.$chroot_addpath."user/".$user_username, $shell, $passwort);

    and delete/comment out the line 767 and 768:

    // Chroot enviroment erstellen
    if($go_info["server"]["ssh_chroot"] == 1) {
    exec("/root/ispconfig/scripts/shell/create_chroot_env.sh $user_username");

    Take care,


Share This Page