Seamless SFTP tunneling / jump boxSSH tunnel hangingWhy is my ssh connection unauthorized although I have updated my key on the remote machine?SSH tunneling via few hostsHow to set up chrooted and non-chrooted sftp?SSH console login working but SFTP does not, why?SSH pageant not workingsshd_selinux_copy_context: getcon failed with No such file or directory (SFTP from Windows to a chrooted account)Why is my SSH connection being closed immediately after pubkey auth succeeds?SSH Configuration Help / Can't tunnelpasswordless ssh to localhost in Ubuntu 16.04
Watching something be written to a file live with tail
What is the word for reserving something for yourself before others do?
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Rock identification in KY
How to format long polynomial?
How does quantile regression compare to logistic regression with the variable split at the quantile?
What does the "remote control" for a QF-4 look like?
Perform and show arithmetic with LuaLaTeX
Why doesn't H₄O²⁺ exist?
NMaximize is not converging to a solution
How old can references or sources in a thesis be?
Replacing matching entries in one column of a file by another column from a different file
How do I deal with an unproductive colleague in a small company?
What is a clear way to write a bar that has an extra beat?
Is it possible to run Internet Explorer on OS X El Capitan?
Why do I get two different answers for this counting problem?
Does an object always see its latest internal state irrespective of thread?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Character reincarnated...as a snail
What are these boxed doors outside store fronts in New York?
tikz convert color string to hex value
What does it mean to describe someone as a butt steak?
How is it possible to have an ability score that is less than 3?
Doing something right before you need it - expression for this?
Seamless SFTP tunneling / jump box
SSH tunnel hangingWhy is my ssh connection unauthorized although I have updated my key on the remote machine?SSH tunneling via few hostsHow to set up chrooted and non-chrooted sftp?SSH console login working but SFTP does not, why?SSH pageant not workingsshd_selinux_copy_context: getcon failed with No such file or directory (SFTP from Windows to a chrooted account)Why is my SSH connection being closed immediately after pubkey auth succeeds?SSH Configuration Help / Can't tunnelpasswordless ssh to localhost in Ubuntu 16.04
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to set up a way for users to connect to the same gateway server
for SSH/SFTP (SFTP a priority, SSH nice to have) and have that gateway
server route the users to private servers inside my network identified by username and the private host they want to reach. This has to be a seamless user experience, i.e - no special config file setup, no flags for command line sessions, and no special setting in UI tools like Filezilla.
What I managed to do so far is add this block to my sshd_config
file in the gateway
server:
Match User someuser
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Now this works great when I'm doing this from a client machine:
ssh -i id_rsa someuser@gateway_server_machine
it will trigger the ForceCommand
and give me an SFTP session to the some_other_server
machine.
BUT
When I do sftp -i id_rsa someuser@gateway_server_machine
the connection hangs and eventually terminated.
so, the sftp doesn't give anything even with verbose - just hangs there - but this is what I get from the server side:
debug1: subsystem: internal-sftp
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' for someuser from 10.16.2.149 port 58822 id 0
on SSH I get:
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' on pts/1 for someuser from 10.16.2.149 port 33550 id 0
debug1: Setting controlling tty using TIOCSCTTY.
I need to figure out what am I doing wrong here, or if there is a better way to provide this kind of connection to my users.
ssh ssh-tunneling sftp
New contributor
add a comment |
I'm trying to set up a way for users to connect to the same gateway server
for SSH/SFTP (SFTP a priority, SSH nice to have) and have that gateway
server route the users to private servers inside my network identified by username and the private host they want to reach. This has to be a seamless user experience, i.e - no special config file setup, no flags for command line sessions, and no special setting in UI tools like Filezilla.
What I managed to do so far is add this block to my sshd_config
file in the gateway
server:
Match User someuser
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Now this works great when I'm doing this from a client machine:
ssh -i id_rsa someuser@gateway_server_machine
it will trigger the ForceCommand
and give me an SFTP session to the some_other_server
machine.
BUT
When I do sftp -i id_rsa someuser@gateway_server_machine
the connection hangs and eventually terminated.
so, the sftp doesn't give anything even with verbose - just hangs there - but this is what I get from the server side:
debug1: subsystem: internal-sftp
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' for someuser from 10.16.2.149 port 58822 id 0
on SSH I get:
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' on pts/1 for someuser from 10.16.2.149 port 33550 id 0
debug1: Setting controlling tty using TIOCSCTTY.
I need to figure out what am I doing wrong here, or if there is a better way to provide this kind of connection to my users.
ssh ssh-tunneling sftp
New contributor
add a comment |
I'm trying to set up a way for users to connect to the same gateway server
for SSH/SFTP (SFTP a priority, SSH nice to have) and have that gateway
server route the users to private servers inside my network identified by username and the private host they want to reach. This has to be a seamless user experience, i.e - no special config file setup, no flags for command line sessions, and no special setting in UI tools like Filezilla.
What I managed to do so far is add this block to my sshd_config
file in the gateway
server:
Match User someuser
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Now this works great when I'm doing this from a client machine:
ssh -i id_rsa someuser@gateway_server_machine
it will trigger the ForceCommand
and give me an SFTP session to the some_other_server
machine.
BUT
When I do sftp -i id_rsa someuser@gateway_server_machine
the connection hangs and eventually terminated.
so, the sftp doesn't give anything even with verbose - just hangs there - but this is what I get from the server side:
debug1: subsystem: internal-sftp
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' for someuser from 10.16.2.149 port 58822 id 0
on SSH I get:
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' on pts/1 for someuser from 10.16.2.149 port 33550 id 0
debug1: Setting controlling tty using TIOCSCTTY.
I need to figure out what am I doing wrong here, or if there is a better way to provide this kind of connection to my users.
ssh ssh-tunneling sftp
New contributor
I'm trying to set up a way for users to connect to the same gateway server
for SSH/SFTP (SFTP a priority, SSH nice to have) and have that gateway
server route the users to private servers inside my network identified by username and the private host they want to reach. This has to be a seamless user experience, i.e - no special config file setup, no flags for command line sessions, and no special setting in UI tools like Filezilla.
What I managed to do so far is add this block to my sshd_config
file in the gateway
server:
Match User someuser
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Now this works great when I'm doing this from a client machine:
ssh -i id_rsa someuser@gateway_server_machine
it will trigger the ForceCommand
and give me an SFTP session to the some_other_server
machine.
BUT
When I do sftp -i id_rsa someuser@gateway_server_machine
the connection hangs and eventually terminated.
so, the sftp doesn't give anything even with verbose - just hangs there - but this is what I get from the server side:
debug1: subsystem: internal-sftp
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' for someuser from 10.16.2.149 port 58822 id 0
on SSH I get:
Starting session: forced-command (config) 'sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server ' on pts/1 for someuser from 10.16.2.149 port 33550 id 0
debug1: Setting controlling tty using TIOCSCTTY.
I need to figure out what am I doing wrong here, or if there is a better way to provide this kind of connection to my users.
ssh ssh-tunneling sftp
ssh ssh-tunneling sftp
New contributor
New contributor
edited 2 days ago
Itai Malek
New contributor
asked 2 days ago
Itai MalekItai Malek
183
183
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
The above will start SFTP client on the intermediate server with its textual interface. Your local SFTP client (sftp
or any other) cannot talk to that. It needs binary SFTP protocol. That also explain why ssh
seeming works as sftp
client. But it does not. It just pipes the textual interface of the sftp
client on the intermediate server.
What you need is something like:
ForceCommand ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
That makes the (most) remote server start SFTP server (-s sftp
) and the intermediate server to pipe the binary SFTP protocol to and back (ssh
just pipes the binary input/output of remote sftp-server
, the same way as in your setup the local ssh
pipes textual input/output of intermediate sftp
).
But if you need both SFTP and SSH you will need to use Subsystem
directive for SFTP, not ForceCommand
:
Subsystem sftp ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Or to avoid having to repeat the tunneling separately for SSH and SFTP, you can use SSH_ORIGINAL_COMMAND
environment variable to decide whether to use -s sftp
or not.
If you actually know that the (most) remote SFTP server has OpenSSH too and the same path to sftp-server
binary as the intermediate server, this should cover both SSH and SFTP:
ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
1
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Itai Malek is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510258%2fseamless-sftp-tunneling-jump-box%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
The above will start SFTP client on the intermediate server with its textual interface. Your local SFTP client (sftp
or any other) cannot talk to that. It needs binary SFTP protocol. That also explain why ssh
seeming works as sftp
client. But it does not. It just pipes the textual interface of the sftp
client on the intermediate server.
What you need is something like:
ForceCommand ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
That makes the (most) remote server start SFTP server (-s sftp
) and the intermediate server to pipe the binary SFTP protocol to and back (ssh
just pipes the binary input/output of remote sftp-server
, the same way as in your setup the local ssh
pipes textual input/output of intermediate sftp
).
But if you need both SFTP and SSH you will need to use Subsystem
directive for SFTP, not ForceCommand
:
Subsystem sftp ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Or to avoid having to repeat the tunneling separately for SSH and SFTP, you can use SSH_ORIGINAL_COMMAND
environment variable to decide whether to use -s sftp
or not.
If you actually know that the (most) remote SFTP server has OpenSSH too and the same path to sftp-server
binary as the intermediate server, this should cover both SSH and SFTP:
ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
1
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
add a comment |
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
The above will start SFTP client on the intermediate server with its textual interface. Your local SFTP client (sftp
or any other) cannot talk to that. It needs binary SFTP protocol. That also explain why ssh
seeming works as sftp
client. But it does not. It just pipes the textual interface of the sftp
client on the intermediate server.
What you need is something like:
ForceCommand ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
That makes the (most) remote server start SFTP server (-s sftp
) and the intermediate server to pipe the binary SFTP protocol to and back (ssh
just pipes the binary input/output of remote sftp-server
, the same way as in your setup the local ssh
pipes textual input/output of intermediate sftp
).
But if you need both SFTP and SSH you will need to use Subsystem
directive for SFTP, not ForceCommand
:
Subsystem sftp ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Or to avoid having to repeat the tunneling separately for SSH and SFTP, you can use SSH_ORIGINAL_COMMAND
environment variable to decide whether to use -s sftp
or not.
If you actually know that the (most) remote SFTP server has OpenSSH too and the same path to sftp-server
binary as the intermediate server, this should cover both SSH and SFTP:
ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
1
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
add a comment |
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
The above will start SFTP client on the intermediate server with its textual interface. Your local SFTP client (sftp
or any other) cannot talk to that. It needs binary SFTP protocol. That also explain why ssh
seeming works as sftp
client. But it does not. It just pipes the textual interface of the sftp
client on the intermediate server.
What you need is something like:
ForceCommand ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
That makes the (most) remote server start SFTP server (-s sftp
) and the intermediate server to pipe the binary SFTP protocol to and back (ssh
just pipes the binary input/output of remote sftp-server
, the same way as in your setup the local ssh
pipes textual input/output of intermediate sftp
).
But if you need both SFTP and SSH you will need to use Subsystem
directive for SFTP, not ForceCommand
:
Subsystem sftp ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Or to avoid having to repeat the tunneling separately for SSH and SFTP, you can use SSH_ORIGINAL_COMMAND
environment variable to decide whether to use -s sftp
or not.
If you actually know that the (most) remote SFTP server has OpenSSH too and the same path to sftp-server
binary as the intermediate server, this should cover both SSH and SFTP:
ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
ForceCommand sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
The above will start SFTP client on the intermediate server with its textual interface. Your local SFTP client (sftp
or any other) cannot talk to that. It needs binary SFTP protocol. That also explain why ssh
seeming works as sftp
client. But it does not. It just pipes the textual interface of the sftp
client on the intermediate server.
What you need is something like:
ForceCommand ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
That makes the (most) remote server start SFTP server (-s sftp
) and the intermediate server to pipe the binary SFTP protocol to and back (ssh
just pipes the binary input/output of remote sftp-server
, the same way as in your setup the local ssh
pipes textual input/output of intermediate sftp
).
But if you need both SFTP and SSH you will need to use Subsystem
directive for SFTP, not ForceCommand
:
Subsystem sftp ssh -s sftp -i /home/someuser/.ssh/id_rsa someuser@some_other_server
Or to avoid having to repeat the tunneling separately for SSH and SFTP, you can use SSH_ORIGINAL_COMMAND
environment variable to decide whether to use -s sftp
or not.
If you actually know that the (most) remote SFTP server has OpenSSH too and the same path to sftp-server
binary as the intermediate server, this should cover both SSH and SFTP:
ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
edited 2 days ago
answered 2 days ago
Martin PrikrylMartin Prikryl
400213
400213
1
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
add a comment |
1
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
1
1
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
thank you ! that worked: ForceCommand ssh -i /home/someuser/.ssh/id_rsa someuser@some_other_server $SSH_ORIGINAL_COMMAND
– Itai Malek
2 days ago
add a comment |
Itai Malek is a new contributor. Be nice, and check out our Code of Conduct.
Itai Malek is a new contributor. Be nice, and check out our Code of Conduct.
Itai Malek is a new contributor. Be nice, and check out our Code of Conduct.
Itai Malek is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510258%2fseamless-sftp-tunneling-jump-box%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown