I think easy way is to do it like this:
In your main form create a public connection variable:
public ConnectionInfo _connectionInfo
Then create new login form by calling it constructor:
var myLoginForm = new LoginForm(); // I assume your login form is called
LoginForm.
In login form create also public variable
public ConnectionInfo _connectionInfo;
Then pass main form _connectionInfo into login form:
myLoginForm._connectionInfo = this._connectionInfo;
And then show the login form:
myLoginForm.Show();
In login form you need to create a new connection into _connectionInfo variable when user press "Login button":
_connectionInfo = new ConnectionInfo("sftp.foo.com",
"guest",
new PasswordAuthenticationMethod("guest", "pwd"),
new PrivateKeyAuthenticationMethod("rsa.key"));
Now close login form after login button is pressed by calling forms close method:
this.Close();
Now in your main form you can use _connectionInfo variable to do all the crazy things with ssh connection.
Hope this will help you. Happy coding!