Migration of Serv-U to MS-FTP in H-Sphere


To migrate Serv-U to MS-FTP in H-Sphere, perform the following steps:


Step 1. Create a user account and user FTP accounts in IIS FTP

Before creating a user account and user FTP accounts, make sure IIS FTP is installed. Then perform the following:

  1. Export all usernames and passwords for physical server from CP database to a file. For this:
    1. Login to CP under root:
      su -l cpanel
      psql hsphere wwwuser
    2. Run:

      select login, password from unix_user where hostid=???

      Replace ??? with ID of the necessary Logical Server
  2. Write down the result in the users.txt file in a folder [drive:]\hsphere\scripts\ (e.g. c:\hsphere\scripts\). The format of results is as follows:
    username pwd
    username pwd
  3. Make the following alterations to the hsphere\scripts\conf.inc file:
    1. change ftpServer = "SERV-U" to ftpServer = "IIS"
    2. run regedit
    3. go to HKEY_LOCAL_MACHINE\SOFTWARE\Psoft\HSphere\Settings and set IIS FtpType
    4. go to HKEY_LOCAL_MACHINE\SOFTWARE\Psoft\HSphere\HsServULayer\Access\ , and delete the Users key. Then recreate the empty Users key.
    5. restart hssvc service in cmd window:

      net stop hssvc
      net start hssvc

    6. restart hsphere service in cmd window:

      net stop hsphere
      net start hsphere

  4. Create IIS Metabase backup.
  5. Stop IIS:
    1. Go to cmd
    2. Run:
  • Rename Hshome folder to 1Hshome (e.g. d:\1hshome) and create empty Hshome folder (e.g. d:\Hshome). If it is possible, create the backup of hshome folder.
  • Create createusersp.asp script in the Hsphere\scripts\ folder:
    <%@ LANGUAGE=JScript %>
    <!-- #include file ="consts.inc" -->
    <!-- #include file ="conf.inc" -->
        Server.ScriptTimeout = 600
        inetSrv = Server.CreateObject(comRsrcManager)
        fs = new ActiveXObject("Scripting.FileSystemObject");
        a = fs.OpenTextFile(Server.MapPath("/cfg/users.txt"), 1, false);
        diskQuota = Server.CreateObject("Microsoft.DiskQuota.1")
        while (!a.AtEndOfLine)
            record  =  a.ReadLine();
            tokens = record.split(new RegExp("[ \n\r\t]"));
            user    = tokens[0];
            password = tokens[1];
            errCode = 0
            aOptions = new Array(useDedicatedUsersGroup)
            flags = new Array(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384)
            options = 0
            for (i = 0; i < aOptions.length; i ++)
                if  (aOptions[i] != 0)
                    options |= flags[i]
            errCode = inetSrv.CreateUser(user, usersHome + "\\" + user, "settler", password, logPath, options)
            if  (errCode != 0)
                Response.Write("User: " + user + " failed<BR>\n")
                Response.Write("User: " + user + " = Ok<BR>\n")

    Step 2. Reset NTFS permissions

    1. Set NTFS permission for Hshome folder:
      1. Run it to set correct owner and NTFS permissions on user home directories:
        setscrt [-owner] [-ntfs] > setscrt.log
        Running the setscrt utility with the -owner and -ntfs options separately, will break the process in two:
        setscrt -owner > setscrt_owner.log
        setscrt -ntfs > setscrt_ntfs.log
      2. Check the log files for report.
    2. (skip this step, if your H-Sphere version is 2.5+)
      Reinstall ASP.NET for all accounts that have it enabled in CP
      1. Get users and domains with installed ASP.NET from CP database. On this step, the scripts will be used in the recreation_scripts directory.
      2. Log into the system database and run the following DB query to select the domain names with ASP.NET support enabled:

        select d.name,i.hostnum from parent_child p1,parent_child p2,parent_child p3,parent_child p4,domains d,iis_vhost i where i.host_id=??? and p1.child_id = i.id and p1.parent_id = p2.child_id and d.id = p2.child_id and p3.parent_id=p2.child_id and p4.parent_id=p3.child_id and p4.child_type=63;

        Replace ??? with the ID of the logical server you are recovering.
      3. Copy the results of the query into a text file in the recreation_scripts directory and name it, for instance, aspnet.txt.
      4. Enter the recreation_scripts directory and run the following command:
        aspnetprepare.bat %1 %2 %3 %4 > aspnet_links.txt
        -rem %1 - file name, e.g. aspnet.txt
        -rem %2 - Winbox IP
        -rem %3 - H-Sphere login used at Winbox installation
        -rem %4 - H-Sphere password used at Winbox installation
      5. Open aspnet_links.txt and remove the first part leaving only the list of links.
      6. Run the following command:
        WGET.EXE -i aspnet_links.txt
        This will recreate all ASP.NET resources on the Winbox.


    Step 3. Recover Winbox quota

    1. Copy the results of the query into a text file in the recreation_scripts directory and name it, for instance, quotat.txt.
    2. Enter the recreation_scripts directory and run the following command:
      Rquota.bat %1 %2 %3 %4 > quota.txt
      -rem %1 - file name, e.g. quota.txt
      -rem %2 - Winbox IP
      -rem %3 - H-Sphere login used at Winbox installation
      -rem %4 - H-Sphere password used at Winbox installation
    3. Open quota.txt and remove the first part leaving only the list of links.
    4. Recreate quota resource on the Winbox:
      WGET.EXE -i quota.txt


    Step 4. Reset AAnonymousaccess for all user domains in IIS

    1. Create setun.js file with the help of Notepad and put the following:
      oldHome = new String(WScript.Arguments.item(0));
      oldHome = oldHome.toLowerCase();
      web = GetObject("IIS://LocalHost/W3SVC");
      allWeb = new Enumerator(web);
      var newDocRootPath, oldDocRootPath, stage = 0;
      for ( ; !allWeb.atEnd(); allWeb.moveNext())
      if (isNaN(parseInt(allWeb.item().name))) continue;
              docRoot = GetObject("IIS://LocalHost/W3SVC/" + allWeb.item().name + "/ROOT");
              docRoot.KeyType = "IIsWebVirtualDir";
              oldDocRootPath = new String(docRoot.Path);
              oldDocRootPath = oldDocRootPath.toLowerCase();
              WScript.Echo("Site: " + allWeb.item().name);
              if  (oldDocRootPath.indexOf(oldHome.toLowerCase()) == -1)
                  WScript.Echo("Site " + allWeb.item().name + " is not H-Sphere web site");
          tokens = docRoot.Get("Path").split(new RegExp("\\\\"));
          username = tokens[tokens.length-2];
          docRoot.Put("AnonymousUserName", username);
          docRoot.Put("AnonymousPasswordSync", 1);
              WScript.Echo("Document root for " + allWeb.item().name + " web site has been changed to " + newDocRootPath);
    2. Run in cmd window:
      cscript setun.js [path to Hshome]
      cscript setun.js e:\hshome

      Note: anonymous access is reset only if domain properties path contains hshome folder and if domain is created by H-Sphere

    3. Restart IIS. Go to cmd->iisreset
    4. Go to hsphere.net\bin\. Open install.history file with the help of Notepad, select all the text, and delete it, save empty install.history file.
    5. Note: for H-Sphere 2.5.x, check if all resources were migrated to a new security scheme

    6. If FTP subaccounts were created in Serv-U, recreate them via CP interface manually.
    7. Open SOAP port 10125 for data communication between Control Panel and Windows server, in the hsphere.properties file on the Control Panel box.

    © Copyright. . PSOFT. All Rights Reserved. Terms | Site Map