This project is read-only.

Failing to Authenticate on SSH_MSG_USERAUTH_PASSWD_CHANGEREQ

Feb 25, 2013 at 10:24 AM
Hi, I am connecting to an SSH server using the PasswordAuthenticationMethod and failing when SendMessage is called with SSH_MSG_USERAUTH_PASSWD_CHANGEREQ.

The event Session_UserAuthenticationFailureReceived is being raised with PartialSuccess being set to false. I can't find anything else to help diagnose my connection issue?

I can connect using FileZilla using the same credentials without issue.

Thanks
Coordinator
Mar 3, 2013 at 2:38 AM
Hi,

Sorry for late response.
The reason SSH_MSG_USERAUTH_PASSWD_CHANGEREQ needs to be sent its because it detects that username password needs to be changed.
I am no sure how and why FileZilla works, may be internally it changes password to itself again or uses some other trick, o might have a bug.
See if you can handle PasswordExpired event. This event is raised when you need to provide a new password.

Here is an example of how you would do it:
           var connectionInfo = new PasswordConnectionInfo("host", "username", "password");
            var encoding = new Renci.SshNet.Common.ASCIIEncoding();
            connectionInfo.PasswordExpired += delegate(object sender, AuthenticationPasswordChangeEventArgs e)
            {
                e.NewPassword = encoding.GetBytes("123456");
            };

            using (var client = new SshClient(connectionInfo))
            {
                client.Connect();

                client.Disconnect();
            }
Hope it helps.

Thanks,
Oleg
Aug 15, 2013 at 8:22 AM
I could not find PasswordExired event on Cennectioninfo class.
Can you let me knw where is it?

thanks
Aug 15, 2013 at 8:40 AM
I found it PasswordConnectionInfo ;-) .
by the way,, who send SSH_MSG_USERAUTH_PASSWD_CHANGEREQ request?
In case. SSH server ask the change password( by default AIX), then How I can recognize this with SSH.NET?