Deleted Admin account from ISP Config DB by accident

Discussion in 'General' started by c0lored, Sep 25, 2018.

  1. c0lored

    c0lored New Member

    Hello, just what the title says really.... I found a post in the ISPConfig2 forum, but it seems like the database has changed enough to make that not work..... Any help please?
    The query I was using that did not work was
    INSERT INTO `sys_user` (`doc_id`, `doctype_id`, `groupid`, `username`, `passwort`, `pwcl`, `design`, `gueltig`, `language`, `mailmax`, `bookmark_order`, `email`, `news`, `modul`, `nav_color`, `box_color`, `site`, `domain`, `perms`, `modules`, `anrede`, `vorname`, `name`, `strasse`, `plz`, `ort`, `telefon`, `fax`, `email_home`, `alter1`, `woher`, `land`, `passwortRecover`, `newsletter`, `userid`) VALUES
    (1, 1, 0, 'admin', '21232f297a57a5a743894a0e4a801fc3', '', 'blau', 1, 'en', 5120000, 1, 'admin', 1, 'isp', '123456', 'E4E4E4', 'ISPConfig', 'ispconfig.de', 'rwa', 'sys,isp,dns,isp_file,isp_fakt,tools,help', 'Herr', '', '', '', '', '', '', '', '', '', '', 'Deutschland', '', 0, 1);
     
  2. Jesse Norell

    Jesse Norell Well-Known Member

    I just ran mysqldump on sys_user table on a 3.1.13 host I'm setting up with only an admin user - here's the ouput schema definition (which you don't need to run, but can compare to yours) and insert (which should work for you if you have the same version/db schema, possibly changing 'groups' (though you could probably do that via the gui once logged in), and of course the password hash:
    Code:
    CREATE TABLE `sys_user` (
      `userid` int(11) unsigned NOT NULL AUTO_INCREMENT,
      `sys_userid` int(11) unsigned NOT NULL DEFAULT '1',
      `sys_groupid` int(11) unsigned NOT NULL DEFAULT '1',
      `sys_perm_user` varchar(5) NOT NULL DEFAULT 'riud',
      `sys_perm_group` varchar(5) NOT NULL DEFAULT 'riud',
      `sys_perm_other` varchar(5) NOT NULL DEFAULT '',
      `username` varchar(64) NOT NULL DEFAULT '',
      `passwort` varchar(64) NOT NULL DEFAULT '',
      `modules` varchar(255) NOT NULL DEFAULT '',
      `startmodule` varchar(255) NOT NULL DEFAULT '',
      `app_theme` varchar(32) NOT NULL DEFAULT 'default',
      `typ` varchar(16) NOT NULL DEFAULT 'user',
      `active` tinyint(1) NOT NULL DEFAULT '1',
      `language` varchar(2) NOT NULL DEFAULT 'en',
      `groups` text,
      `default_group` int(11) unsigned NOT NULL DEFAULT '0',
      `client_id` int(11) unsigned NOT NULL DEFAULT '0',
      `id_rsa` varchar(2000) NOT NULL DEFAULT '',
      `ssh_rsa` varchar(600) NOT NULL DEFAULT '',
      `lost_password_function` tinyint(1) NOT NULL DEFAULT '1',
      `lost_password_hash` varchar(50) NOT NULL DEFAULT '',
      `lost_password_reqtime` datetime DEFAULT NULL,
      PRIMARY KEY (`userid`)
    ) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
    
    Code:
    INSERT INTO `sys_user` VALUES (1,1,0,'riud','riud','','admin','redacted_hash','dashboard,admin,client,mail,monitor,sites,dns,
    vm,tools,help','dashboard','default','admin',1,'en','1',1,0,'','',1,'',NULL);
     
    till and ahrasis like this.

Share This Page