Report: Username and last login

Please post here if you have problems in using Wing FTP Server.
Post Reply
pepsupport
Posts: 14
Joined: Thu Jul 13, 2023 2:48 pm

Report: Username and last login

Post by pepsupport »

Is there a way to pull all users and their last login date?
FTP
Site Admin
Posts: 2155
Joined: Tue Sep 29, 2009 6:09 am

Re: Report: Username and last login

Post by FTP »

OK, you can execute the following Lua script in "Administration > Console", just replace the first line "domain1" with your domain name.

Code: Select all

   local domain = "domain1"
   local strUserlist = c_GetUserList(domain)
   local userlist = Split(strUserlist,"\n")

   for _,username in pairs(userlist) do
      local user = c_GetUser(domain,username)

      if user ~= nil then
	print("User: "..username.."\n")
	if user.last_loginip ~= "" and user.last_logintime ~= "" then
		print("Last login time: "..user.last_logintime.."\n")
	end
	print("\n")
      end
   end
Post Reply