Problem
When connecting via bssh -p 8222 user@host and trying to run sudo -s or passwd, password input doesn't work correctly. The same commands work fine with regular ssh command.
Root Cause Analysis
After deep investigation of the codebase, identified two critical issues:
1. Empty Terminal Modes (PRIMARY ISSUE)
Location: src/pty/session.rs:171
self.channel.request_pty(
false,
&self.config.term_type,
width,
height,
0, // pixel width
0, // pixel height
&[], // ❌ PROBLEM: terminal modes (empty array)
)
Impact:
- SSH PTY is requested with empty terminal modes array
- sudo and passwd require specific terminal modes (ECHO, ICANON, ISIG, etc.) to securely handle password input
- Empty array causes SSH server to use defaults that don't match sudo's requirements
Required Terminal Modes:
- ECHO (53): Control echo for password masking
- ICANON (54): Canonical mode for line-based input
- ISIG (50): Signal generation (Ctrl+C, etc.)
- Additional modes for proper terminal behavior
2. Potential Duplicate PTY Requests
Flow:
connect_to_node_pty() → client.request_interactive_shell() (requests PTY)
PtySession::run() → initialize() → channel.request_pty() (requests PTY again!)
Impact: May cause conflicts or undefined behavior
Testing
Tested with -t flag to force PTY mode:
bssh -t -p 8222 user@host
Still fails, confirming this is a code-level bug, not a configuration issue.
Solution Requirements
- Set proper terminal modes in
channel.request_pty() call
- Remove duplicate PTY request logic
- Ensure compatibility with interactive programs (sudo, passwd, vi, etc.)
References
- SSH Protocol: RFC 4254 Section 6.2 (Requesting a Pseudo-Terminal)
- Terminal modes list: RFC 4254 Section 8 (Encoding of Terminal Modes)
- Related code:
src/pty/session.rs:156-184, src/commands/interactive.rs:511-640
Priority
High - Affects core interactive functionality
Problem
When connecting via
bssh -p 8222 user@hostand trying to runsudo -sorpasswd, password input doesn't work correctly. The same commands work fine with regularsshcommand.Root Cause Analysis
After deep investigation of the codebase, identified two critical issues:
1. Empty Terminal Modes (PRIMARY ISSUE)
Location:
src/pty/session.rs:171Impact:
Required Terminal Modes:
2. Potential Duplicate PTY Requests
Flow:
connect_to_node_pty()→client.request_interactive_shell()(requests PTY)PtySession::run()→initialize()→channel.request_pty()(requests PTY again!)Impact: May cause conflicts or undefined behavior
Testing
Tested with
-tflag to force PTY mode:Still fails, confirming this is a code-level bug, not a configuration issue.
Solution Requirements
channel.request_pty()callReferences
src/pty/session.rs:156-184,src/commands/interactive.rs:511-640Priority
High - Affects core interactive functionality