Need help with LUA script to list all all users and their fi

You can share your Lua Scripts with everybody here.
Post Reply
serveradmin2233
Posts: 3
Joined: Tue Jun 08, 2021 1:35 pm

Need help with LUA script to list all all users and their fi

Post by serveradmin2233 »

Can't figure out the variable for the directory path for the user. I have this so far that will give me all expired accounts and the expiration date, but i would also like to list the directory path.

local domain = "basler.com"
local userlist = Split(c_GetUserList(domain), "\n")
for _,username in pairs(userlist) do
local user = c_GetUser(domain,username,dir)
if user.enable_expire == true then
local expiretime = c_TranslateTime(user.expiretime)
local nowtime = os.time()
if nowtime > expiretime then
print(username)
print(";")
print(user.expiretime)
print("\n")
end
end
end
FTP
Site Admin
Posts: 1935
Joined: Tue Sep 29, 2009 6:09 am

Re: Need help with LUA script to list all all users and thei

Post by FTP »

OK, you can list all the directory path by the following script:

Code: Select all

if user["directories"] ~= nil then
	for _,directory in pairs(user["directories"]) do
		if directory.is_home_dir then
			print("Home dir: "..directory.dir.."\n")
		else
			print("Virtual dir: "..directory.dir.."\n")
		end
	end
	print("\n\n")
end
Post Reply