Table of Contents

Property ChangePassword

Namespace
SshSharp
Assembly
SshSharp.dll

ChangePassword

Answers the server's request to change an expired password (SSH_MSG_USERAUTH_PASSWD_CHANGEREQ, RFC 4252 section 8) with the new one, or null to decline. The password just sent is sent again as the old one, with the new one; when the server refuses the new password it can ask again (at most 3 times), and when it accepts it, the connection is authenticated (or goes on to the next method the server requires). Null (the default), or declining, leaves the password unchanged: the attempt counts as failed (PasswordChangeRequired) and the other methods are tried.

public Func<SshPasswordChangeRequest, CancellationToken, ValueTask<string?>>? ChangePassword { get; init; }

Property Value

Func<SshPasswordChangeRequest, CancellationToken, ValueTask<string>>

Remarks

Store the new password only once the connect succeeds: until then the server may not have accepted it. Servers that change passwords through PAM ask through keyboard-interactive instead, which KeyboardInteractive answers.