Re: Remotely Change Password (General questions)
Christopher,
Here is full example:[code]
Public Class Form1
Dim WithEvents ssh1 As WeOnlyDo.Client.SSH
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ssh1 = New WeOnlyDo.Client.SSH
ssh1.Hostname = your_hostname
ssh1.Blocking = True
ssh1.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSH2
ssh1.Login = your_login
ssh1.Password = your_password
ssh1.Connect()
ssh1.WaitFor( regex:[$ #>] $ )
ssh1.DataReady = 0
ssh1.Send( passwd + vbLf)
ssh1.WaitFor( (current) UNIX password: )
ssh1.Send( old_password + vbLf)
ssh1.WaitFor( Enter new UNIX password: )
ssh1.Send( new_password + vbLf)
ssh1.WaitFor( Retype new UNIX password: )
ssh1.Send( new_password + vbLf)
End Sub
End Class
[/code]
When you are connected to server you should use wodSSH.NET WaitFor and Send Method. WaitFor to receive prompt and Send to send command.
Command to change password on UNIX servers is passwd. I cannot be sure that you will receive exact prompt as I did when issuing passwd ((current) UNIX password:, Enter new UNIX password:, Retype new UNIX password:).
Maybe you should first check prompt using for example SSH client Putty and than add it to wodSSH.NET WaitFor Method.
Let us know how it goes.
Regards,
Drazen
Complete thread:
- Remotely Change Password - Christopher Brandt, 2008-03-14, 17:53
- Re: Remotely Change Password - woddrazen, 2008-03-14, 18:35
- Re: Remotely Change Password - Christopher Brandt, 2008-03-14, 19:02
- Re: Remotely Change Password - woddrazen, 2008-03-14, 19:23
- Re: Remotely Change Password - Christopher Brandt, 2008-03-14, 19:53
- Re: Remotely Change Password - woddrazen, 2008-03-14, 19:23
- Re: Remotely Change Password - Christopher Brandt, 2008-03-14, 19:02
- Re: Remotely Change Password - woddrazen, 2008-03-14, 18:35