Port forward for connections without shell access #604
Unanswered
fullc0ntr0l
asked this question in
Q&A
Replies: 1 comment 7 replies
-
Actually that happens on user with shell access too. Here's the code I'm trying to execute import asyncio
import asyncssh
import sys
import logging
logging.basicConfig(level="DEBUG")
asyncssh.set_debug_level(2)
async def run_client() -> None:
async with asyncssh.connect(
HOST,
username=USERNAME,
password=PASSWORD,
) as conn:
listener = await conn.forward_local_port(
"",
0,
REMOTE_ADDR,
REMOTE_PORT,
)
await listener.wait_closed()
try:
asyncio.get_event_loop().run_until_complete(run_client())
except (OSError, asyncssh.Error) as exc:
sys.exit("SSH connection failed: " + str(exc)) |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What's the equivalent of ssh
-N
argument when doing local port forwarding with no shell access user?I'm trying to run the first example from here but it closes my connection
Beta Was this translation helpful? Give feedback.
All reactions