How to close an existing SSH tunnel?How do I tell Git for Windows where to find my private RSA key?How to...
Recommendation letter by significant other if you worked with them professionally?
meaning and function of 幸 in "则幸分我一杯羹"
PTIJ: wiping amalek’s memory?
List elements digit difference sort
Definition of Statistic
Does a warlock using the Darkness/Devil's Sight combo still have advantage on ranged attacks against a target outside the Darkness?
Could you please stop shuffling the deck and play already?
how to copy/paste a formula in Excel absolutely?
Shifting between bemols (flats) and diesis (sharps)in the key signature
Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?
Are there historical instances of the capital of a colonising country being temporarily or permanently shifted to one of its colonies?
Do f-stop and exposure time perfectly cancel?
Accepted offer letter, position changed
Does "Until when" sound natural for native speakers?
Makefile strange variable substitution
How can I ensure my trip to the UK will not have to be cancelled because of Brexit?
How to detect if C code (which needs 'extern C') is compiled in C++
Is it necessary to separate DC power cables and data cables?
In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?
Is "history" a male-biased word ("his+story")?
Should I take out a loan for a friend to invest on my behalf?
Hotkey (or other quick way) to insert a keyframe for only one component of a vector-valued property?
What was the Kree's motivation in Captain Marvel?
Bash script should only kill those instances of another script's that it has launched
How to close an existing SSH tunnel?
How do I tell Git for Windows where to find my private RSA key?How to automate SSH login with password?How can I close SSH tunnel gracefully?ssh returns “Bad owner or permissions on ~/.ssh/config”SSH tunnel doesn't workssh tunnel - bind: Cannot assign requested addressConnecting to MYSQL over SSH tunnelSSH tunnel issues since setting up public key loginHow to have ssh tunnel prompt for username & passwordRemote SSH Tunnel external access
In Windows, I create a scheduled task on Windows startup:
C:cygwin64binssh.exe -R 2222:127.0.0.1:3389 user@PublicHost
to expose my rdp service on a public-ip server, and I can connect rdp successfuly, but I cannot find ssh.exe in task manager, and when I shutdown windows, sometimes the 2222 port of PublicHost is not released, so later I boot windows again, the ssh.exe will give me a warning, port forwarding failed.
Is there a way to ask PublicHost to release the port (I don't have root access on PublicHost)?
windows ssh tunnel
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
In Windows, I create a scheduled task on Windows startup:
C:cygwin64binssh.exe -R 2222:127.0.0.1:3389 user@PublicHost
to expose my rdp service on a public-ip server, and I can connect rdp successfuly, but I cannot find ssh.exe in task manager, and when I shutdown windows, sometimes the 2222 port of PublicHost is not released, so later I boot windows again, the ssh.exe will give me a warning, port forwarding failed.
Is there a way to ask PublicHost to release the port (I don't have root access on PublicHost)?
windows ssh tunnel
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
In Windows, I create a scheduled task on Windows startup:
C:cygwin64binssh.exe -R 2222:127.0.0.1:3389 user@PublicHost
to expose my rdp service on a public-ip server, and I can connect rdp successfuly, but I cannot find ssh.exe in task manager, and when I shutdown windows, sometimes the 2222 port of PublicHost is not released, so later I boot windows again, the ssh.exe will give me a warning, port forwarding failed.
Is there a way to ask PublicHost to release the port (I don't have root access on PublicHost)?
windows ssh tunnel
In Windows, I create a scheduled task on Windows startup:
C:cygwin64binssh.exe -R 2222:127.0.0.1:3389 user@PublicHost
to expose my rdp service on a public-ip server, and I can connect rdp successfuly, but I cannot find ssh.exe in task manager, and when I shutdown windows, sometimes the 2222 port of PublicHost is not released, so later I boot windows again, the ssh.exe will give me a warning, port forwarding failed.
Is there a way to ask PublicHost to release the port (I don't have root access on PublicHost)?
windows ssh tunnel
windows ssh tunnel
edited Sep 8 '16 at 16:17
MadHatter
70.3k11145207
70.3k11145207
asked Sep 8 '16 at 15:48
Kingzone WongKingzone Wong
62
62
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Can you run ssh in the foreground so that you get a shell prompt and can just logout of the ssh session?
Because if windows is shutting down and terminating ssh.exe, it should close that port. And if it's not getting released by the server, sending your own kill signal will likely have the same effect (if you could find it in task manager).
Or perhaps you could login (manual or scripted) into the PublicHost and kill things on that side (like /bin/bash of your UID) so the connection is dropped?
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
add a comment |
If you just connect to port 2222 of PublicHost it should attempt to send traffic through the tunnel. This will time out (after a few minutes) or receive a reset response (immediately), which will result in the connection being closed and the sshd process exiting.
You do this using any number of tools, but here's one way to do it automatically from Windows:
C:cygwin64binssh.exe user@PublicHost "echo x | nc 127.0.0.1 2222"
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fserverfault.com%2fquestions%2f801908%2fhow-to-close-an-existing-ssh-tunnel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can you run ssh in the foreground so that you get a shell prompt and can just logout of the ssh session?
Because if windows is shutting down and terminating ssh.exe, it should close that port. And if it's not getting released by the server, sending your own kill signal will likely have the same effect (if you could find it in task manager).
Or perhaps you could login (manual or scripted) into the PublicHost and kill things on that side (like /bin/bash of your UID) so the connection is dropped?
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
add a comment |
Can you run ssh in the foreground so that you get a shell prompt and can just logout of the ssh session?
Because if windows is shutting down and terminating ssh.exe, it should close that port. And if it's not getting released by the server, sending your own kill signal will likely have the same effect (if you could find it in task manager).
Or perhaps you could login (manual or scripted) into the PublicHost and kill things on that side (like /bin/bash of your UID) so the connection is dropped?
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
add a comment |
Can you run ssh in the foreground so that you get a shell prompt and can just logout of the ssh session?
Because if windows is shutting down and terminating ssh.exe, it should close that port. And if it's not getting released by the server, sending your own kill signal will likely have the same effect (if you could find it in task manager).
Or perhaps you could login (manual or scripted) into the PublicHost and kill things on that side (like /bin/bash of your UID) so the connection is dropped?
Can you run ssh in the foreground so that you get a shell prompt and can just logout of the ssh session?
Because if windows is shutting down and terminating ssh.exe, it should close that port. And if it's not getting released by the server, sending your own kill signal will likely have the same effect (if you could find it in task manager).
Or perhaps you could login (manual or scripted) into the PublicHost and kill things on that side (like /bin/bash of your UID) so the connection is dropped?
answered Sep 8 '16 at 16:02
Ryan BabchishinRyan Babchishin
5,16011032
5,16011032
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
add a comment |
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
When the windows is rebooted, I want the ssh.exe to be run even before I login. that's why I need a scheduled task. If I login to PublicHost, and kill all sshd related to the current user, all other normal ssh connection will also be dropped.
– Kingzone Wong
Sep 8 '16 at 16:34
add a comment |
If you just connect to port 2222 of PublicHost it should attempt to send traffic through the tunnel. This will time out (after a few minutes) or receive a reset response (immediately), which will result in the connection being closed and the sshd process exiting.
You do this using any number of tools, but here's one way to do it automatically from Windows:
C:cygwin64binssh.exe user@PublicHost "echo x | nc 127.0.0.1 2222"
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
add a comment |
If you just connect to port 2222 of PublicHost it should attempt to send traffic through the tunnel. This will time out (after a few minutes) or receive a reset response (immediately), which will result in the connection being closed and the sshd process exiting.
You do this using any number of tools, but here's one way to do it automatically from Windows:
C:cygwin64binssh.exe user@PublicHost "echo x | nc 127.0.0.1 2222"
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
add a comment |
If you just connect to port 2222 of PublicHost it should attempt to send traffic through the tunnel. This will time out (after a few minutes) or receive a reset response (immediately), which will result in the connection being closed and the sshd process exiting.
You do this using any number of tools, but here's one way to do it automatically from Windows:
C:cygwin64binssh.exe user@PublicHost "echo x | nc 127.0.0.1 2222"
If you just connect to port 2222 of PublicHost it should attempt to send traffic through the tunnel. This will time out (after a few minutes) or receive a reset response (immediately), which will result in the connection being closed and the sshd process exiting.
You do this using any number of tools, but here's one way to do it automatically from Windows:
C:cygwin64binssh.exe user@PublicHost "echo x | nc 127.0.0.1 2222"
answered Sep 9 '16 at 3:48
Tom ShawTom Shaw
3,4641022
3,4641022
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
add a comment |
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
I tried, it's OK, but you have to wait for a long-time timeout, and seems this timeout should be configured on PublicHost with root user?
– Kingzone Wong
Sep 10 '16 at 3:42
add a comment |
Thanks for contributing an answer to Server Fault!
- 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%2fserverfault.com%2fquestions%2f801908%2fhow-to-close-an-existing-ssh-tunnel%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