This little guide describes the possibilities you have to interact with a running G6FTP Server via the COM Object or via its settings files to create account, modify settings or export statistics for example.
By creating files in G6FTP Server settings directory, you can directly add new domain, users or modify any settings.
- in your <install>\Accounts\ directory, create a directory which will be the new domain you want to add (Ex : ftp.test.com)
- in this new directory, create a file named 'settings.ini' which will contains the main settings of the domain, in this file put :
[Domain]
CanDeleteReadOnly=-1
ChangeDataIPDependingOnClientIP=-1
DontLimitSpeedForLAN=-1
HammerResetOnLogin=-1
IP0=*,21,
LogCacheEnabled=-1
LogEnabled=-1
LogList0=Default,REGULAR,"65535,65535,$DOM_NAME-$year-$mm.log"
LogList1=Transfers,TRANSFERS,"3,-1,$DOM_NAME-transfers-$year-$mm.log"
LogList2=Bandwidth,BANDWIDTH,7
MaxClients=0
MaxConnectionsPerIP=0
ResolveIP=-1
Running=13544
StatsCurrentlyLogged=0
Status=0
- create 2 directories named 'Users' and 'Groups', this is where you will put the new account.
- go into 'Users', create a file named 'Anonymous.ini' to create a Anonymous account, open it and put :
[Account]
AccessList0=/,c:\ftp,R---,FD--I---
CreationDate=2004/04/21 18:23:37
Enabled=-1
PasswordEnabled=0
- go into 'Groups', and create a file named 'Friends.ini' to create a Anonymous account, open it and put :
[Group]
CreationDate=2004/04/21 19:25:51
AccessList0=/,c:\ftproot,R---,FD--I---
BannedFileList0=*.pif,Denied
FreeFileList0=*.txt
IPAccessList0=192.168.0.10,Allowed,local user
Notes=Some notes ...
Scripts0=Log downloads.vbs
Scripts1=Log uploads.vbs
Scripts2=SiteCommands.vbs
SiteCommandList0=TEST,c:\test.exe $1,1,60,1,1,Test command
Note : some IP access, free files, banned files and scripts are defined in the group as an example, you can also define the same in the user account.
- There are other files that you can access concerning settings :
- \Accounts\settings.ini handles the FTP Server settings
- \RemoteAdmin\Remote.ini handles Administrator accounts and admin server settings :
[Server]
IP=*,8021\r\n
[Acct=Administrator]
Enabled=1
Password=949F0CBD0B5FFF229AE444CC4A570D80
Rights=0
Password is saved in MD5.
Those examples are not exhaustives, it is suggested to test possible variable name by using Administration client and examining produced ini files.
Notes :
- changes are not immediate, G6FTP Server caches the account information for faster access.
- you can force the cache flush by creating a file named 'reload' (empty, no extension) in <install>\ root directory, this file is deleted after the reload.
For advanced developers, you can directly interact with G6FTP Server by commanding it via the exposed TLB and properties using VBScript for example.
The com object needs to be accessible from the account you are using so check dcomcfng to add the Windows account to the access list.
Here is an example using the available object from VBScript :
' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
' Simple script that shows how to use vbs to create/modify accounts and properties
' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
' Define objects to use with manager
Dim Manager, Domain, Settings, User
' Consts used for accounts creation
Const LogSettings = "Default,REGULAR,""65535,65535,$DOM_NAME-$year-$mm.log"""
Const IPBinding = "*,21,ESSL" ' '',ESSL, ESSLO, ISSL
Const DomainName = "ftp.test.com"
Const UserName = "Anonymous"
Const GroupName = "Friends"
' * * * * * * Create manager object * * * * * * *
Set Manager = CreateObject("G6FTPServer.Manager")
' * * * * * * First Domain properties * * * * * *
' Show some domains properties
if Manager.Domains.Count > 0 then
s = "Status for : "&Manager.Domains.Item(0).Name&vbCRLF
s = s&" Clients : "&Manager.Domains.Item(0).Clients&vbCRLF
s = s&" Downloads : "&Manager.Domains.Item(0).Downloads&vbCRLF
s = s&" Uploads : "&Manager.Domains.Item(0).Uploads&vbCRLF
s = s&" Bandwidth : "&Manager.Domains.Item(0).Bandwidth_In&" / "
&Manager.Domains.Item(0).Bandwidth_Out
msgbox s
end if
' * * * * * * New Domain * * * * * * * * * * * *
' Check if domain already exists
Set Domain = Manager.Domains.Item(DomainName)
if Domain is Nothing then
' Add domain
Set Domain = Manager.Domains.Add(DomainName)
' Set some values
Set Settings = Domain.Properties
Settings.Values("LogList") = LogSettings
Settings.Values("IP") = IPBinding
' Apply new settings
Settings.ApplyChanges()
msgbox "Domain "&DomainName&" has been created!", VBInformation
end if
' * * * * * * New User * * * * * * * * * * * * *
Set Domain = Manager.Domains.Item(DomainName)
' Check if user already exists
if Domain.UserList.Item(UserName) is Nothing then
' Add user
Set User = Domain.UserList.Add(UserName)
' Set some values
User.Properties.Values("Enabled") = "1"
User.Properties.Values("PasswordEnabled") = "0"
'User.Properties.Values("Password") = "MD5:"+MD5("hello")
User.Properties.Values("AccessList") = "/,c:\ftproot,R,FDI"&vbCRLF&"/temp,c:\temp,R,FDI"
User.Properties.Values("IPAccessList") =
"192.168.0.*,Allowed,Local users"&vbCRLF&"192.168.0.11,Denied,Local user"
msgbox "User "&UserName&" has been created in "&DomainName&"!", VBInformation
end if
' * * * * * * New Group * * * * * * * * * * * * *
Set Domain = Manager.Domains.Item(DomainName)
' Check if group already exists
if Domain.GroupList.Item(GroupName) is Nothing then
' Add group
Set Group = Domain.GroupList.Add(GroupName)
' Set some values
Group.Properties.Values("Enabled") = "1"
Group.Properties.Values("PasswordEnabled") = "0"
Group.Properties.Values("AccessList") = "/,c:\ftproot,R,FDI"&vbCRLF&"/temp,c:\temp,R,FDI"
Group.Properties.Values("IPAccessList") =
"192.168.0.*,Allowed,Local users"&vbCRLF&"192.168.0.11,Denied,Local user"
msgbox "Group "&GroupName&" has been created in "&DomainName&"!", VBInformation
end if
' * * * * * * Delete Domain * * * * * * * * * * * * *
' Ask to delete new domain
res = msgbox ("Press OK to delete "&DomainName&" or Cancel to abort",
VBOKCancel+VBCritical, "Delete "&DomainName&" ?")
' Delete if OK
if res = VBOK then
Manager.Domains.Item(DomainName).Delete()
msgbox "Domain "&DomainName&" has been deleted!", VBInformation
end if
Chapter II and III covers available TLB and properties of server, domain, messages, user and group.
|