Note: This answer only applies to old releases of Rebex SFTP and SSH components. Check out this answer for newer versions.
Instances of Sftp object can be initialized to use an existing SSH session, but Ssh and Scp don't have this capability yet. However, adding this functionality would be quite simply and we can add it into the next release if needed.
string serverName = "tcharles";
string userName = "tester0";
string password = "psw4tester";
// create a SSH session (alternatively, you can use the Session property
// of Sftp, Ssh or Scp object and skip Connect and Authenticate methods)
SshSession ssh = new SshSession();
ssh.Connect(serverName);
ssh.Authenticate(userName, password);
// create an SFTP channel
SshChannel channel1 = ssh.OpenSession();
channel1.RequestSubsystem("sftp");
// initialize an SFTP session based on the channel
Sftp sftp1 = new Sftp();
sftp1.Bind(channel1.ToSocket());
Console.WriteLine(string.Join("\n", sftp1.GetRawList("*.txt")));
// create another SFTP channel
SshChannel channel2 = ssh.OpenSession();
channel2.RequestSubsystem("sftp");
// create an SFTP session based on another channel
Sftp sftp2 = new Sftp();
sftp2.Bind(channel2.ToSocket());
Console.WriteLine(string.Join("\n", sftp2.GetRawList("*.txt")));
// both SFTP sessions are already usable - there is no need to
// call Connect and Login methods
...
In the next version, we would add a new overload of the Bind method that accepts an SshSession object, making the code simpler (no need to bother with SshChannel any more).
With the current version, you can initialize an Ssh instance first and then create Sftp instance that shares the same SSH session. If you need more, please let us know and we will send you a beta when this feature is available.