Forced user password change SFTP

Please post here if you have problems in using Wing FTP Server.
TeamBas
Posts: 11
Joined: Wed Sep 15, 2021 8:59 am

Forced user password change SFTP

Post by TeamBas »

Dear WingFTP Team,

Is there an option that can be set to force the user to change their SFTP password!?

Regards
TeamBas
TeamBas
Posts: 11
Joined: Wed Sep 15, 2021 8:59 am

Re: Forced user password change SFTP

Post by TeamBas »

Dear WingFTP-Team,

Can you help us to create a lua script to Change all user passwords for HTTPS and SFTP

We have more than 2000 users

Regards
TeamBas
FTP
Site Admin
Posts: 1935
Joined: Tue Sep 29, 2009 6:09 am

Re: Forced user password change SFTP

Post by FTP »

You can't change the password in the SFTP client software, SFTP protocol doesn't support such function.

And changing all user passwords for HTTPS/SFTP is possible, so do you want to change all user passwords into the same password?
TeamBas
Posts: 11
Joined: Wed Sep 15, 2021 8:59 am

Re: Forced user password change SFTP

Post by TeamBas »

No, we only want to force users to change their passwords and no more.

Thx
TeamBas
FTP
Site Admin
Posts: 1935
Joined: Tue Sep 29, 2009 6:09 am

Re: Forced user password change SFTP

Post by FTP »

OK, you can force user change his password, but it is for the web client only, because if you use a FTP/SFTP client software, it can't popup a Change Password form.
TeamBas
Posts: 11
Joined: Wed Sep 15, 2021 8:59 am

Re: Forced user password change SFTP

Post by TeamBas »

Do you have an example of how to force this?

Thx
TeamBas
FTP
Site Admin
Posts: 1935
Joined: Tue Sep 29, 2009 6:09 am

Re: Forced user password change SFTP

Post by FTP »

First, please enable the domain option "Domain > Settings > General Settings > Password & Security > Need to change the password on the first logon", also enable the option "Edit user -> General -> User can change their password" for all the user accounts.

And then execute the following Lua script under "Web admin -> Administration -> Console" (replace the string "YourDomainName" into your own domain name):

Code: Select all

local domain = "YourDomainName"
local userlist = Split(c_GetUserList(domain), "\n")
for _,username in pairs(userlist) do
c_ResetUserLoginIP(domain, username)
end
TeamBas
Posts: 11
Joined: Wed Sep 15, 2021 8:59 am

Re: Forced user password change SFTP

Post by TeamBas »

How can I change this value for all users?
Image

Thx
TeamBas
FTP
Site Admin
Posts: 1935
Joined: Tue Sep 29, 2009 6:09 am

Re: Forced user password change SFTP

Post by FTP »

OK, you can run the following script under "Administration -> Console":

Code: Select all

local domain = "YourDomainName"

local userlist = Split(c_GetUserList(domain), "\n")
for _,username in pairs(userlist) do

local user = c_GetUser(domain, username)
for k,v in pairs(user) do
if type(v) == "boolean" then
if v == true then
user[k] = 1
else
user[k] = 0
end
end
end

user.oldpassword = user.password


user.change_pass = 1
user.pass_length = 14
AddUser(domain, user)

end

BTW, it seems you are using an old version of WingFTP, so you had better upgrade to the latest version 6.6.2 first.
TeamBas
Posts: 11
Joined: Wed Sep 15, 2021 8:59 am

Re: Forced user password change SFTP

Post by TeamBas »

Thanks, Super worked :)

But the first Password script works only for the first user who tries to log in.
All other users are not prompted, maybe you have a solution for this?

Thx
TeamBas
Version 6.5.2
Post Reply