Please post here if you have problems in using Wing FTP Server.

Forced user password change SFTP

Wed Sep 15, 2021 9:20 am

Dear WingFTP Team,

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

Regards
TeamBas

Re: Forced user password change SFTP

Wed Sep 15, 2021 9:55 am

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

Re: Forced user password change SFTP

Wed Sep 15, 2021 3:56 pm

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?

Re: Forced user password change SFTP

Thu Sep 16, 2021 12:49 pm

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

Thx
TeamBas

Re: Forced user password change SFTP

Thu Sep 16, 2021 5:08 pm

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.

Re: Forced user password change SFTP

Fri Sep 17, 2021 6:10 am

Do you have an example of how to force this?

Thx
TeamBas

Re: Forced user password change SFTP

Fri Sep 17, 2021 11:08 am

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:
local domain = "YourDomainName"
local userlist = Split(c_GetUserList(domain), "\n")
for _,username in pairs(userlist) do
c_ResetUserLoginIP(domain, username)
end

Re: Forced user password change SFTP

Wed Sep 22, 2021 2:03 pm

How can I change this value for all users?
Image

Thx
TeamBas

Re: Forced user password change SFTP

Fri Sep 24, 2021 4:55 pm

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

Code:
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.

Re: Forced user password change SFTP

Tue Sep 28, 2021 10:54 am

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