Hi,
I installed Filezilla server a few days ago, and it was working perfectly. I wrote a ColdFusion script to create user accounts by editing the FileZilla Server.xml file, and that worked perfectly too. I have the Task Scheduler in Windows set to reload the configuration file (with /reload-config) every 15 minutes in case there are new users, and that worked fine too.
Then this morning I needed to reboot my server for a different reason. After the reboot, the Filezilla Service is running, and I have no problem connecting to the server with the administrative program, but nothing works. I am running everything from the console on the server:
1) The administrative interface shows no groups and no users. When I try to add a new user, I get this message:
Protocol error: Invalid data, could not import account settings.
Could not change account settings
2) I tried deleting the existing Filezilla Server.xml file, and I get the same result as above. I also tried deleting both xml files, and it did not solve the problems.
I tried re-installing FileZilla, rebooting the server again, and I get the same results as above. Do you have any idea what is wrong?
Thanks,
Ron
Cannot add users or read xml file
Moderator: Project members
-
- 500 Command not understood
- Posts: 3
- Joined: 2010-01-06 23:19
- First name: Ron
- Last name: Bekey
Problem solved! Cannot add users or read xml file
Problem solved!
I deleted the XML files one more time, and the error went away. I also discovered I had an error in my ColdFusion script which was inserting one stray line of code in the XML, resulting in a misread of the whole file. Thanks for creating an excellent piece of software!
Ron
I deleted the XML files one more time, and the error went away. I also discovered I had an error in my ColdFusion script which was inserting one stray line of code in the XML, resulting in a misread of the whole file. Thanks for creating an excellent piece of software!
Ron
-
- 500 Command not understood
- Posts: 3
- Joined: 2010-05-28 00:57
- First name: Jason
- Last name: Lyons
Re: Cannot add users or read xml file
Hi Ron,
Do you think I could get a copy of your code?
I'm very interested in doing this myself.
Regards,
J
Do you think I could get a copy of your code?
I'm very interested in doing this myself.
Regards,
J
-
- 500 Command not understood
- Posts: 3
- Joined: 2010-01-06 23:19
- First name: Ron
- Last name: Bekey
Re: Cannot add users or read xml file
This is the code I used. It is very specific to the code I use for classes I teach, but you may find parts of it useful. Please do not ask for support in modifying this--I do not have time, sorry. Disclaimer: This code was not intended for distribution, and I make no warranty that it will work for any purpose.
<!--- confirm home folder exists --->
<!--- note: xxx and yyy represent directories on my server.
<cfset ThisDir="c:\InetPub\xxx\yyy\#session.userid#">
<cfif Not DirectoryExists(#ThisDir#)>
<p></p>
<font size="+1">Home directory <b><cfoutput>#session.userid#</cfoutput></b> does not exist.</font>
<p></p>
<hr>
<cfabort>
</cfif>
<!--- see if FTP account already exists --->
<cffile action="read" file="C:\Program Files\FileZilla Server\FileZilla Server.xml"
variable="xmldoc">
<cfif Find('<User Name="#session.userid#">',xmldoc) GT 0>
<font size="+1">There is already an FTP account for <cfoutput><b>#session.userid#</b></cfoutput>. You do not need to run this file.</b> You are now ready to FTP.</font>
<cfabort>
</cfif>
<!--- Define constants --->
<cfset variables.Lf = chr(10)>
<cfset variables.CrLf = Chr(13) & Chr(10)>
<cfset variables.tab = Chr(9)>
<!--- Get username and password --->
<cfset username="#session.userid#">
<!--- datasource is the name of your datasource. --->
<cfquery name="getpassword" datasource="datasource1">
SELECT password
FROM tblData
WHERE tblData.userid='#session.userid#';
</cfquery>
<!--- Note: xxxxx represents the string of characters I used for encrypting the password in my database. --->
<cftry>
<cfset variables.decryptpwd=Decrypt(getpassword.password,'xxxxx')>
<cfcatch type = "any">
An error occurred while trying to create your FTP account. Please <a href="ftpadduser.cfm">Try again</a>.
<cfabort>
</cfcatch>
</cftry>
<p></p>
<cfset password="#variables.decryptpwd#">
<cfset password=Hash(password)>
<cfset password=LCase(password)>
<!--- insert data in XML file --->
<!--- usertext.xml is a file I created with information for a user with the settings I wanted, based on one I created manually with the Filezilla interface. I copied and pasted the code from the XML file. --->
<cffile action="read" file="C:\Inetpub\xxx\yyy\usertext.xml"
variable="usertext">
<cfset strText = Insert('#CrLf##CrLf##tab##tab#<User Name="#username#">#CrLf##tab##tab#<Option Name="Pass">#password#</Option>#CrLf##usertext#',xmldoc,Find("<Users>",xmldoc)+6)>
<cfset strText=Replace(strText,"tempname","#username#")>
<cffile action="write" file="C:\Program Files\FileZilla Server\FileZilla Server.xml" output="#strText#">
<!--- verify new data is in file now --->
<cffile action="read" file="C:\Program Files\FileZilla Server\FileZilla Server.xml"
variable="xmldoc">
<cfif Find("#session.userid#",xmldoc) GT 0>
<font size="+1">FTP account for <b><cfoutput>#username#</cfoutput></b> created!
<cfelse>
<b>There was an error in creating your FTP account. Please try to run this file again.</b>
</cfif>
<!--- confirm home folder exists --->
<!--- note: xxx and yyy represent directories on my server.
<cfset ThisDir="c:\InetPub\xxx\yyy\#session.userid#">
<cfif Not DirectoryExists(#ThisDir#)>
<p></p>
<font size="+1">Home directory <b><cfoutput>#session.userid#</cfoutput></b> does not exist.</font>
<p></p>
<hr>
<cfabort>
</cfif>
<!--- see if FTP account already exists --->
<cffile action="read" file="C:\Program Files\FileZilla Server\FileZilla Server.xml"
variable="xmldoc">
<cfif Find('<User Name="#session.userid#">',xmldoc) GT 0>
<font size="+1">There is already an FTP account for <cfoutput><b>#session.userid#</b></cfoutput>. You do not need to run this file.</b> You are now ready to FTP.</font>
<cfabort>
</cfif>
<!--- Define constants --->
<cfset variables.Lf = chr(10)>
<cfset variables.CrLf = Chr(13) & Chr(10)>
<cfset variables.tab = Chr(9)>
<!--- Get username and password --->
<cfset username="#session.userid#">
<!--- datasource is the name of your datasource. --->
<cfquery name="getpassword" datasource="datasource1">
SELECT password
FROM tblData
WHERE tblData.userid='#session.userid#';
</cfquery>
<!--- Note: xxxxx represents the string of characters I used for encrypting the password in my database. --->
<cftry>
<cfset variables.decryptpwd=Decrypt(getpassword.password,'xxxxx')>
<cfcatch type = "any">
An error occurred while trying to create your FTP account. Please <a href="ftpadduser.cfm">Try again</a>.
<cfabort>
</cfcatch>
</cftry>
<p></p>
<cfset password="#variables.decryptpwd#">
<cfset password=Hash(password)>
<cfset password=LCase(password)>
<!--- insert data in XML file --->
<!--- usertext.xml is a file I created with information for a user with the settings I wanted, based on one I created manually with the Filezilla interface. I copied and pasted the code from the XML file. --->
<cffile action="read" file="C:\Inetpub\xxx\yyy\usertext.xml"
variable="usertext">
<cfset strText = Insert('#CrLf##CrLf##tab##tab#<User Name="#username#">#CrLf##tab##tab#<Option Name="Pass">#password#</Option>#CrLf##usertext#',xmldoc,Find("<Users>",xmldoc)+6)>
<cfset strText=Replace(strText,"tempname","#username#")>
<cffile action="write" file="C:\Program Files\FileZilla Server\FileZilla Server.xml" output="#strText#">
<!--- verify new data is in file now --->
<cffile action="read" file="C:\Program Files\FileZilla Server\FileZilla Server.xml"
variable="xmldoc">
<cfif Find("#session.userid#",xmldoc) GT 0>
<font size="+1">FTP account for <b><cfoutput>#username#</cfoutput></b> created!
<cfelse>
<b>There was an error in creating your FTP account. Please try to run this file again.</b>
</cfif>
tenderedge wrote:Hi Ron,
Do you think I could get a copy of your code?
I'm very interested in doing this myself.
Regards,
J
-
- 500 Command not understood
- Posts: 3
- Joined: 2010-05-28 00:57
- First name: Jason
- Last name: Lyons
Re: Cannot add users or read xml file
Brilliant! Thanks mate,
I made a few changes. But works like a charm.
Many thanks,
J
I made a few changes. But works like a charm.
Many thanks,
J