hierynomus / hierynomus/sshj

Switching user before SCP file transfer

Open
#651 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

Hello Jeroen!

I'm trying to implement scenario:
1. It needs to download a file from remote host via SCP
2. To get access to it, I need to connect to remote host under user A, then switch to user B like "sudo su - B", for
user A has no permission to read a file I need
and user B has no permission to connect to that remote host.

It looks like a quite common case, but I can't make it working with SSHJ for I don't see an opportunity to call "sudo su - B" in SCPEngine before a file transfer starts.

I was trying to switch user for a Session before SCPEngine is created, but it always leads to "net.schmizz.sshj.common.SSHRuntimeException: This session channel is all used up" for session is not allowed to be reused.

I hope there is a way to do this trick, could you please advise?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.