Skip to content

Question: How do I create a hopped ssh session via a tunnel? #27

@SnoCold

Description

@SnoCold

Hi,
I was going through the code and found this method

pub fn [open_forward](https://docs.rs/libssh-rs/latest/libssh_rs/struct.Channel.html#method.open_forward)(
    &self,
    remote_host: &[str](https://doc.rust-lang.org/nightly/std/primitive.str.html),
    remote_port: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html),
    source_host: &[str](https://doc.rust-lang.org/nightly/std/primitive.str.html),
    source_port: [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)
) -> [SshResult](https://docs.rs/libssh-rs/latest/libssh_rs/type.SshResult.html)<[()](https://doc.rust-lang.org/nightly/std/primitive.unit.html)>

I am interested in creating an ssh tunnel via a bastion host to remote server e.g.
ssh -l localhost:1234:192.168.1.1:22 root@bastion

where 192.168.1.1 is the remote server with username root

and then creating a session as such

ssh localhost -p 1234 -l root

How would I achieve this using this library? and how would I authenticate ?
assuming initial session to bastion is established.

Please do let me know.

Thank you,
Regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions