Virtual User Integration - A basic example

The example presented below display the basics with virtual user integration; two virtual accounts with different passwords and different home directory configuration.

Verification script in zFTPServer:
C:\Scripts\login.cmd "%IP%" "%USERNAME%" "%PASSWORD%"

Contents of file "C:\Scripts\login.cmd":
@echo off

rem Extract IP and remove quotes
set IP=%1
for /f "useback tokens=*" %%a in ('%IP%') do set IP=%%~a

rem Extract Username and remove quotes
set USER=%2
for /f "useback tokens=*" %%a in ('%USER%') do set USER=%%~a

rem Extract Password and remove quotes
set PASS=%3
for /f "useback tokens=*" %%a in ('%PASS%') do set PASS=%%~a

rem Check for valid logins

if /I "%USER%" == "testuser1" (
   if "%PASS%" == "pass pass" (
      exit 0
   )
)

if /I "%USER%" == "testuser2" (
   if "%PASS%" == "password" (
      if "%IP%" == "127.0.0.1" (
         exit 0
      )
   )
)

rem No valid login found - Deny access
exit 1
    Configuration script in zFTPServer:
C:\Scripts\userconfig.cmd "%USERNAME%"

Contents of file "C:\Scripts\userconfig.cmd":
@echo off

rem Extract username and remove quotes
set USER=%1
for /f "useback tokens=*" %%a in ('%USER%') do set USER=%%~a

rem Configure accounts

if /I "%USER%" == "testuser1" (
   echo !Restriction - VirtualAccount
   echo /Virtual folder for testuser1^|^|
   echo /^|C:\^|RF,LD,RR
)

if /I "%USER%" == "testuser2" (
   echo !Restriction - VirtualAccount
   echo /a virtual folder^|^|
   echo /^|C:\^|RF,LD,RR
)