How to use a existing channel ssh connect to another remote host?
Open
Nobody has claimed this yet.
question
- Dominant language
- Rust
- Stars
- 566
- Forks
- 163
- Avg merge
- 4h 51m
- Merged PRs (30d)
- 2
Description
I want to connect to another remote host through a springboard machine that is already connected.
My code as follows:
let tcp = TcpStream::connect("xx").unwrap();
let mut sess = Session::new().unwrap();
sess.set_tcp_stream(tcp);
sess.handshake().unwrap();
sess.userauth_password("user", "passwd").unwrap();
let mut channel = sess.channel_session().unwrap();
channel.request_pty(
"xterm",
None,
Some((80, 24, 0, 0)),).unwrap();
channel.shell().unwrap();
channel.write(b"ssh xx@xx \n").unwrap();
//channel.write(b"yes \n").unwrap();
channel.write(b"passwd\n").unwrap();
channel.write(b"ls\n").unwrap()
It doesn't work, would someone help me. Thank you in advance
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the reported Rust calls to Session, channel_session, request_pty, shell, and write in the ssh2-rs documentation and examples. Reproduce the nested SSH attempt and determine whether the reported behavior is a library bug or an unsupported usage pattern; document the result and a verified resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100