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:
- Export all usernames and passwords for physical server from CP database to a file. For this:
- Login to CP under root:
su -l cpanel
psql hsphere wwwuser
- Run:
select login, password from unix_user where hostid=???
Replace ??? with ID of the necessary Logical Server
- 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
- Make the following alterations to the hsphere\scripts\conf.inc file:
- change ftpServer = "SERV-U" to ftpServer = "IIS"
- run regedit
- go to HKEY_LOCAL_MACHINE\SOFTWARE\Psoft\HSphere\Settings and set IIS FtpType
- go to HKEY_LOCAL_MACHINE\SOFTWARE\Psoft\HSphere\HsServULayer\Access\ , and delete the Users key. Then recreate
the empty Users key.
- restart hssvc service in cmd window:
net stop hssvc
net start hssvc
- restart hsphere service in cmd window:
net stop hsphere
net start hsphere
- Create IIS Metabase backup.
- Stop IIS:
- Go to cmd
- Run:
iisreset/stop
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)
Server.Execute("/cfg/set-config.asp")
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")
else
Response.Write("User: " + user + " = Ok<BR>\n")
Response.Flush()
}
a.Close();
%>
Step 2. Reset NTFS permissions
- Set NTFS permission for Hshome folder:
- 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
- Check the log files for report.
- (skip this step, if your H-Sphere version is 2.5+)
Reinstall ASP.NET for all accounts that have it enabled in CP
- Get users and domains with installed ASP.NET from CP database. On this step, the scripts will be used in the recreation_scripts directory.
- 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.
- Copy the results of the query into a text file in the recreation_scripts directory and name it, for instance,
aspnet.txt.
- Enter the recreation_scripts directory and run the following command:
aspnetprepare.bat %1 %2 %3 %4 > aspnet_links.txt
where:
-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
- Open aspnet_links.txt and remove the first part leaving only the list of links.
- 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
- Copy the results of the query into a text file in the recreation_scripts directory and name it,
for instance, quotat.txt.
- Enter the recreation_scripts directory and run the following command:
Rquota.bat %1 %2 %3 %4 > quota.txt
where:
-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
- Open quota.txt and remove the first part leaving only the list of links.
- Recreate quota resource on the Winbox:
WGET.EXE -i quota.txt
Step 4. Reset AAnonymousaccess for all user domains in IIS
- 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";
docRoot.SetInfo();
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");
continue;
}
tokens = docRoot.Get("Path").split(new RegExp("\\\\"));
username = tokens[tokens.length-2];
docRoot.Put("AnonymousUserName", username);
docRoot.Put("AnonymousPasswordSync", 1);
docRoot.SetInfo();
WScript.Echo("Document root for " + allWeb.item().name + " web site has been changed to " + newDocRootPath);
}
- Run in cmd window:
cscript setun.js [path to Hshome]
Example:
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
- Restart IIS. Go to cmd->iisreset
- 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.
-
Note: for H-Sphere 2.5.x, check if all resources were migrated to a new security scheme
- If FTP subaccounts were created in Serv-U, recreate them via CP interface manually.
- Open SOAP port 10125 for data communication between Control Panel and Windows server, in the hsphere.properties file on the Control Panel box.
|