Remote port forwarded SSH considered as an invalid user accessing from 127.0.0.1
I am trying to connect to a server which already established a remote ssh connection to my client by running the following on server:
ssh -R :8080:localhost:22 -p 22 clientUser@clientIP
when I try to connect to the server by running the following on the client side:
ssh -p 8080 localhost
I am getting asked for a password as:
clientUser@localhost's password:
both connections should be able to establish via public key (the remote port forwarding ssh already can do this with no problem.)
furthermore in /var/log/auth.log on server shows:
Invalid user clientUser from 127.0.0.1 port 39768
which suggests that the server sees this as kind of a loopback connection?
the client OS is MacOSX Mojave and the server side is Ubuntu 18.04 LTS.
If I try to remote forward the connection from the client to any port other than 22 on the server I am getting
ssh_exchange_identification: Connection closed by remote host
I appreciate your kind help!
macos ubuntu unix ssh portforwarding
add a comment |
I am trying to connect to a server which already established a remote ssh connection to my client by running the following on server:
ssh -R :8080:localhost:22 -p 22 clientUser@clientIP
when I try to connect to the server by running the following on the client side:
ssh -p 8080 localhost
I am getting asked for a password as:
clientUser@localhost's password:
both connections should be able to establish via public key (the remote port forwarding ssh already can do this with no problem.)
furthermore in /var/log/auth.log on server shows:
Invalid user clientUser from 127.0.0.1 port 39768
which suggests that the server sees this as kind of a loopback connection?
the client OS is MacOSX Mojave and the server side is Ubuntu 18.04 LTS.
If I try to remote forward the connection from the client to any port other than 22 on the server I am getting
ssh_exchange_identification: Connection closed by remote host
I appreciate your kind help!
macos ubuntu unix ssh portforwarding
The "Invalid user" message and request for password imply that there's no user namedclientUser
on the server. Since that is what you are specifying, is that not what you're expecting? You might wantssh -p 8080 serverUser@localhost
?
– Chris Dodd
Dec 28 '18 at 23:39
The "Connection closed" message when you try to forward to a port other than 22 implies that whatever is listening on that port is not expecting an ssh_exchange. What port are you trying to forward to and what do you expect to be listening there?
– Chris Dodd
Dec 28 '18 at 23:39
you are right. thanks a lot for the clarification.ssh -p 8080 serverUser@localhost
works now.
– Milad Kiaee
Dec 29 '18 at 1:16
I believe the problem with other ports would be also the fact that they are not expecging the ssh connection but the main problem was solved thanks to you.
– Milad Kiaee
Dec 29 '18 at 1:18
add a comment |
I am trying to connect to a server which already established a remote ssh connection to my client by running the following on server:
ssh -R :8080:localhost:22 -p 22 clientUser@clientIP
when I try to connect to the server by running the following on the client side:
ssh -p 8080 localhost
I am getting asked for a password as:
clientUser@localhost's password:
both connections should be able to establish via public key (the remote port forwarding ssh already can do this with no problem.)
furthermore in /var/log/auth.log on server shows:
Invalid user clientUser from 127.0.0.1 port 39768
which suggests that the server sees this as kind of a loopback connection?
the client OS is MacOSX Mojave and the server side is Ubuntu 18.04 LTS.
If I try to remote forward the connection from the client to any port other than 22 on the server I am getting
ssh_exchange_identification: Connection closed by remote host
I appreciate your kind help!
macos ubuntu unix ssh portforwarding
I am trying to connect to a server which already established a remote ssh connection to my client by running the following on server:
ssh -R :8080:localhost:22 -p 22 clientUser@clientIP
when I try to connect to the server by running the following on the client side:
ssh -p 8080 localhost
I am getting asked for a password as:
clientUser@localhost's password:
both connections should be able to establish via public key (the remote port forwarding ssh already can do this with no problem.)
furthermore in /var/log/auth.log on server shows:
Invalid user clientUser from 127.0.0.1 port 39768
which suggests that the server sees this as kind of a loopback connection?
the client OS is MacOSX Mojave and the server side is Ubuntu 18.04 LTS.
If I try to remote forward the connection from the client to any port other than 22 on the server I am getting
ssh_exchange_identification: Connection closed by remote host
I appreciate your kind help!
macos ubuntu unix ssh portforwarding
macos ubuntu unix ssh portforwarding
asked Dec 28 '18 at 23:27
Milad KiaeeMilad Kiaee
44
44
The "Invalid user" message and request for password imply that there's no user namedclientUser
on the server. Since that is what you are specifying, is that not what you're expecting? You might wantssh -p 8080 serverUser@localhost
?
– Chris Dodd
Dec 28 '18 at 23:39
The "Connection closed" message when you try to forward to a port other than 22 implies that whatever is listening on that port is not expecting an ssh_exchange. What port are you trying to forward to and what do you expect to be listening there?
– Chris Dodd
Dec 28 '18 at 23:39
you are right. thanks a lot for the clarification.ssh -p 8080 serverUser@localhost
works now.
– Milad Kiaee
Dec 29 '18 at 1:16
I believe the problem with other ports would be also the fact that they are not expecging the ssh connection but the main problem was solved thanks to you.
– Milad Kiaee
Dec 29 '18 at 1:18
add a comment |
The "Invalid user" message and request for password imply that there's no user namedclientUser
on the server. Since that is what you are specifying, is that not what you're expecting? You might wantssh -p 8080 serverUser@localhost
?
– Chris Dodd
Dec 28 '18 at 23:39
The "Connection closed" message when you try to forward to a port other than 22 implies that whatever is listening on that port is not expecting an ssh_exchange. What port are you trying to forward to and what do you expect to be listening there?
– Chris Dodd
Dec 28 '18 at 23:39
you are right. thanks a lot for the clarification.ssh -p 8080 serverUser@localhost
works now.
– Milad Kiaee
Dec 29 '18 at 1:16
I believe the problem with other ports would be also the fact that they are not expecging the ssh connection but the main problem was solved thanks to you.
– Milad Kiaee
Dec 29 '18 at 1:18
The "Invalid user" message and request for password imply that there's no user named
clientUser
on the server. Since that is what you are specifying, is that not what you're expecting? You might want ssh -p 8080 serverUser@localhost
?– Chris Dodd
Dec 28 '18 at 23:39
The "Invalid user" message and request for password imply that there's no user named
clientUser
on the server. Since that is what you are specifying, is that not what you're expecting? You might want ssh -p 8080 serverUser@localhost
?– Chris Dodd
Dec 28 '18 at 23:39
The "Connection closed" message when you try to forward to a port other than 22 implies that whatever is listening on that port is not expecting an ssh_exchange. What port are you trying to forward to and what do you expect to be listening there?
– Chris Dodd
Dec 28 '18 at 23:39
The "Connection closed" message when you try to forward to a port other than 22 implies that whatever is listening on that port is not expecting an ssh_exchange. What port are you trying to forward to and what do you expect to be listening there?
– Chris Dodd
Dec 28 '18 at 23:39
you are right. thanks a lot for the clarification.
ssh -p 8080 serverUser@localhost
works now.– Milad Kiaee
Dec 29 '18 at 1:16
you are right. thanks a lot for the clarification.
ssh -p 8080 serverUser@localhost
works now.– Milad Kiaee
Dec 29 '18 at 1:16
I believe the problem with other ports would be also the fact that they are not expecging the ssh connection but the main problem was solved thanks to you.
– Milad Kiaee
Dec 29 '18 at 1:18
I believe the problem with other ports would be also the fact that they are not expecging the ssh connection but the main problem was solved thanks to you.
– Milad Kiaee
Dec 29 '18 at 1:18
add a comment |
1 Answer
1
active
oldest
votes
thanks to Chris in comments.
the problem was I had to
ssh -p 8080 serverUser@localhost
by default
ssh -p 8080 localhost
is the same as
ssh -p 8080 ${USER}@localhost
and uses the current user from the environment. This will results in an invalid user message by the server.
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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%2fstackoverflow.com%2fquestions%2f53965381%2fremote-port-forwarded-ssh-considered-as-an-invalid-user-accessing-from-127-0-0-1%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
thanks to Chris in comments.
the problem was I had to
ssh -p 8080 serverUser@localhost
by default
ssh -p 8080 localhost
is the same as
ssh -p 8080 ${USER}@localhost
and uses the current user from the environment. This will results in an invalid user message by the server.
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
add a comment |
thanks to Chris in comments.
the problem was I had to
ssh -p 8080 serverUser@localhost
by default
ssh -p 8080 localhost
is the same as
ssh -p 8080 ${USER}@localhost
and uses the current user from the environment. This will results in an invalid user message by the server.
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
add a comment |
thanks to Chris in comments.
the problem was I had to
ssh -p 8080 serverUser@localhost
by default
ssh -p 8080 localhost
is the same as
ssh -p 8080 ${USER}@localhost
and uses the current user from the environment. This will results in an invalid user message by the server.
thanks to Chris in comments.
the problem was I had to
ssh -p 8080 serverUser@localhost
by default
ssh -p 8080 localhost
is the same as
ssh -p 8080 ${USER}@localhost
and uses the current user from the environment. This will results in an invalid user message by the server.
edited Dec 29 '18 at 20:42
answered Dec 29 '18 at 1:27
Milad KiaeeMilad Kiaee
44
44
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
add a comment |
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
Thanks, I edited the answer to reflect this.
– Milad Kiaee
Dec 29 '18 at 20:43
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f53965381%2fremote-port-forwarded-ssh-considered-as-an-invalid-user-accessing-from-127-0-0-1%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
The "Invalid user" message and request for password imply that there's no user named
clientUser
on the server. Since that is what you are specifying, is that not what you're expecting? You might wantssh -p 8080 serverUser@localhost
?– Chris Dodd
Dec 28 '18 at 23:39
The "Connection closed" message when you try to forward to a port other than 22 implies that whatever is listening on that port is not expecting an ssh_exchange. What port are you trying to forward to and what do you expect to be listening there?
– Chris Dodd
Dec 28 '18 at 23:39
you are right. thanks a lot for the clarification.
ssh -p 8080 serverUser@localhost
works now.– Milad Kiaee
Dec 29 '18 at 1:16
I believe the problem with other ports would be also the fact that they are not expecging the ssh connection but the main problem was solved thanks to you.
– Milad Kiaee
Dec 29 '18 at 1:18