SSH Failing to fork with sshpass
Clash Royale CLAN TAG#URR8PPP
I've a problem with port forwarding command using sshpass.
Problem is that it's working on one server and does not work on another.
Both are Debian 7 x64 boxes.
sshpass -p password ssh -f -D 0.0.0.0:2002 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=debug root@5.5.5.5 -T -N
This command works with no problems on server 1 but does not work on server 2.
Debug output from failing server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
Debug output from working server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
debug1: Entering interactive session.
Sshpass and ssh binaries are equal on both servers. I've checked this using md5sum.
Does anyone have an idea what could be wrong? I'm losing my mind trying to solve this mystery.
debian ssh port-forwarding
add a comment |
I've a problem with port forwarding command using sshpass.
Problem is that it's working on one server and does not work on another.
Both are Debian 7 x64 boxes.
sshpass -p password ssh -f -D 0.0.0.0:2002 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=debug root@5.5.5.5 -T -N
This command works with no problems on server 1 but does not work on server 2.
Debug output from failing server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
Debug output from working server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
debug1: Entering interactive session.
Sshpass and ssh binaries are equal on both servers. I've checked this using md5sum.
Does anyone have an idea what could be wrong? I'm losing my mind trying to solve this mystery.
debian ssh port-forwarding
add a comment |
I've a problem with port forwarding command using sshpass.
Problem is that it's working on one server and does not work on another.
Both are Debian 7 x64 boxes.
sshpass -p password ssh -f -D 0.0.0.0:2002 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=debug root@5.5.5.5 -T -N
This command works with no problems on server 1 but does not work on server 2.
Debug output from failing server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
Debug output from working server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
debug1: Entering interactive session.
Sshpass and ssh binaries are equal on both servers. I've checked this using md5sum.
Does anyone have an idea what could be wrong? I'm losing my mind trying to solve this mystery.
debian ssh port-forwarding
I've a problem with port forwarding command using sshpass.
Problem is that it's working on one server and does not work on another.
Both are Debian 7 x64 boxes.
sshpass -p password ssh -f -D 0.0.0.0:2002 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=debug root@5.5.5.5 -T -N
This command works with no problems on server 1 but does not work on server 2.
Debug output from failing server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
Debug output from working server:
Authenticated to 5.5.5.5 ([5.5.5.5]:22).
debug1: Local connections to 0.0.0.0:2002 forwarded to remote address socks:0
debug1: Local forwarding listening on 0.0.0.0 port 2002.
debug1: channel 0: new [port listener]
debug1: forking to background
debug1: Entering interactive session.
Sshpass and ssh binaries are equal on both servers. I've checked this using md5sum.
Does anyone have an idea what could be wrong? I'm losing my mind trying to solve this mystery.
debian ssh port-forwarding
debian ssh port-forwarding
edited Jun 13 '16 at 2:22
Jeff Schaller
41.7k1156133
41.7k1156133
asked Aug 9 '14 at 0:40
MarkMark
314
314
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
TL;DR
This worked for me:
sshpass -p password nohup ssh -f ... >/dev/null
Well, I almost lost my mind too.
The difference between your debian hosts that causes sshpass to either work or not is the number of CPU cores. The issue appears on a single-core host. Playing with strace showed that sshpass process is killed by the system after receiving SIGHUP. On a multi-core host, the forked ssh process has enough time to setup SIGHUP handler so it's not killed.
As a workaround you can use nohup utility to run sshpass so it's not killed by SIGHUP.
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
);
);
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%2f149335%2fssh-failing-to-fork-with-sshpass%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
TL;DR
This worked for me:
sshpass -p password nohup ssh -f ... >/dev/null
Well, I almost lost my mind too.
The difference between your debian hosts that causes sshpass to either work or not is the number of CPU cores. The issue appears on a single-core host. Playing with strace showed that sshpass process is killed by the system after receiving SIGHUP. On a multi-core host, the forked ssh process has enough time to setup SIGHUP handler so it's not killed.
As a workaround you can use nohup utility to run sshpass so it's not killed by SIGHUP.
add a comment |
TL;DR
This worked for me:
sshpass -p password nohup ssh -f ... >/dev/null
Well, I almost lost my mind too.
The difference between your debian hosts that causes sshpass to either work or not is the number of CPU cores. The issue appears on a single-core host. Playing with strace showed that sshpass process is killed by the system after receiving SIGHUP. On a multi-core host, the forked ssh process has enough time to setup SIGHUP handler so it's not killed.
As a workaround you can use nohup utility to run sshpass so it's not killed by SIGHUP.
add a comment |
TL;DR
This worked for me:
sshpass -p password nohup ssh -f ... >/dev/null
Well, I almost lost my mind too.
The difference between your debian hosts that causes sshpass to either work or not is the number of CPU cores. The issue appears on a single-core host. Playing with strace showed that sshpass process is killed by the system after receiving SIGHUP. On a multi-core host, the forked ssh process has enough time to setup SIGHUP handler so it's not killed.
As a workaround you can use nohup utility to run sshpass so it's not killed by SIGHUP.
TL;DR
This worked for me:
sshpass -p password nohup ssh -f ... >/dev/null
Well, I almost lost my mind too.
The difference between your debian hosts that causes sshpass to either work or not is the number of CPU cores. The issue appears on a single-core host. Playing with strace showed that sshpass process is killed by the system after receiving SIGHUP. On a multi-core host, the forked ssh process has enough time to setup SIGHUP handler so it's not killed.
As a workaround you can use nohup utility to run sshpass so it's not killed by SIGHUP.
edited Nov 26 '17 at 2:07
answered Nov 23 '17 at 4:34
tifssofttifssoft
51115
51115
add a comment |
add a comment |
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%2f149335%2fssh-failing-to-fork-with-sshpass%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