I need to enable MFA massively for all the 300+ users on my FTP server (a mixture of local users and users locally mapped to AD).
I tried using the code below as a scheduled task as i someone suggested online but it only switch on MFA for the first user. I'm having trouble troubleshooting it because i do not have any log (i.e. i don't even know where the print function actually prints. Can anybody help? is there another, easier, way?
Thanks
Code: Select all
do
local domains = c_GetDomainList()
for _, domain in pairs(domains) do
local userlist_raw = c_GetUserList(domain)
local userlist = Split(userlist_raw or "", "\n")
for _, username in pairs(userlist) do
if username ~= "" then
local user = c_GetUser(domain, username)
if user ~= nil then
local changed = false
-- Turn on TOTP for Web Client
if user.enable_two_factor ~= 1 and user.enable_two_factor ~= true then
user.enable_two_factor = 1
changed = true
end
if changed == true then
-- Preserve current password field per vendor examples before saving
user.oldpassword = user.password
-- Persist the updated user object
AddUser(domain, user)
print(string.format("[%-20s] Enabled TOTP for '%s'%s",domain, username))
end
end
end
end
end
end
Wing FTP Server
English
Deutsch
简体中文