CP Users: username validation rules

Discussion in 'Installation/Configuration' started by Pyanepsion, Dec 25, 2025.

Tags:
  1. Pyanepsion

    Pyanepsion Member

    Hello,
    When creating or editing a CP user (System → CP Users), the following error message may appear:
    Could you please clarify the exact rules applied?
    —What is the maximum allowed length for a CP username?
    —Which characters are allowed (and, if applicable, forbidden)?
    —Are these rules identical for all ‘Username’ (username_txt) fields in ISPConfig?
    If applicable, are these constraints defined:
    —at the database schema level,
    —or in the application code (and where)?
    Thank you.
     
  2. Pyanepsion

    Pyanepsion Member

    In
    /usr/local/ispconfig/interface/lib/classes/functions.inc.php,
    the function is_allowed_user() is used to validate system users (system_user):
    Code:
    public function is_allowed_user($username, $restrict_names = false) {
        $name_blacklist = array('root','ispconfig','vmail','getmail');
        if(in_array($username,$name_blacklist)) return false;
        if(preg_match('/^[a-zA-Z0-9\.\-_]{1,32}$/', $username) == false) return false;
        if($restrict_names == true && preg_match('/^web\d+$/', $username) == false) return false;
        return true;
    }
    Is this same function also used to validate the Username field of CP Users (sys_user.username)?
    If not, where is the validation specific to this field implemented (file / function)?
     

Share This Page