Login with SSH authorized key with changed SSH port
I changed my SSH port in the /etc/ssh/sshd_config
file and then restarted the ssh service. I implemented fail2ban and updated the port to my SSH under that config. I also then implemented the UFW firewall and allowed incoming connections to my new SSH port.
However, when I try and login with my SSH key using ssh -i /Users/myuser/.ssh/vpsssh user@555.555.555.555
it's trying to connect to port 22 instead of the defined port I have.
ssh login
add a comment |
I changed my SSH port in the /etc/ssh/sshd_config
file and then restarted the ssh service. I implemented fail2ban and updated the port to my SSH under that config. I also then implemented the UFW firewall and allowed incoming connections to my new SSH port.
However, when I try and login with my SSH key using ssh -i /Users/myuser/.ssh/vpsssh user@555.555.555.555
it's trying to connect to port 22 instead of the defined port I have.
ssh login
1
Server and client do not about each other automatically. They both use the default port 22, unles is changed, onsshd_config
for server, or specified on command for cliente like here
– bistoco
2 hours ago
3
Possible duplicate of How to connect to a certain port on SSH
– pa4080
2 hours ago
IMO, this question is not about Ubuntu at all:/Users/...
must be/home/...
– pa4080
2 hours ago
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
50 mins ago
add a comment |
I changed my SSH port in the /etc/ssh/sshd_config
file and then restarted the ssh service. I implemented fail2ban and updated the port to my SSH under that config. I also then implemented the UFW firewall and allowed incoming connections to my new SSH port.
However, when I try and login with my SSH key using ssh -i /Users/myuser/.ssh/vpsssh user@555.555.555.555
it's trying to connect to port 22 instead of the defined port I have.
ssh login
I changed my SSH port in the /etc/ssh/sshd_config
file and then restarted the ssh service. I implemented fail2ban and updated the port to my SSH under that config. I also then implemented the UFW firewall and allowed incoming connections to my new SSH port.
However, when I try and login with my SSH key using ssh -i /Users/myuser/.ssh/vpsssh user@555.555.555.555
it's trying to connect to port 22 instead of the defined port I have.
ssh login
ssh login
asked 2 hours ago
user1048676user1048676
1265
1265
1
Server and client do not about each other automatically. They both use the default port 22, unles is changed, onsshd_config
for server, or specified on command for cliente like here
– bistoco
2 hours ago
3
Possible duplicate of How to connect to a certain port on SSH
– pa4080
2 hours ago
IMO, this question is not about Ubuntu at all:/Users/...
must be/home/...
– pa4080
2 hours ago
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
50 mins ago
add a comment |
1
Server and client do not about each other automatically. They both use the default port 22, unles is changed, onsshd_config
for server, or specified on command for cliente like here
– bistoco
2 hours ago
3
Possible duplicate of How to connect to a certain port on SSH
– pa4080
2 hours ago
IMO, this question is not about Ubuntu at all:/Users/...
must be/home/...
– pa4080
2 hours ago
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
50 mins ago
1
1
Server and client do not about each other automatically. They both use the default port 22, unles is changed, on
sshd_config
for server, or specified on command for cliente like here– bistoco
2 hours ago
Server and client do not about each other automatically. They both use the default port 22, unles is changed, on
sshd_config
for server, or specified on command for cliente like here– bistoco
2 hours ago
3
3
Possible duplicate of How to connect to a certain port on SSH
– pa4080
2 hours ago
Possible duplicate of How to connect to a certain port on SSH
– pa4080
2 hours ago
IMO, this question is not about Ubuntu at all:
/Users/...
must be /home/...
– pa4080
2 hours ago
IMO, this question is not about Ubuntu at all:
/Users/...
must be /home/...
– pa4080
2 hours ago
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
50 mins ago
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
50 mins ago
add a comment |
1 Answer
1
active
oldest
votes
You can specify a non-default port on the ssh
client command line using the -p
option. From man ssh
:
-p port
Port to connect to on the remote host. This can be specified on
a per-host basis in the configuration file.
You may wish to put both the port number and the identity file location for the host in a ~/.ssh/config
file so that they don't need to be specified every time on the command line.
Ex.
Host myremotehost
Hostname 555.555.555.555
User user
Port 20002
IdentityFile /Users/myuser/.ssh/vpsssh
Then you will be able to use:
ssh myremotehost
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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%2faskubuntu.com%2fquestions%2f1111994%2flogin-with-ssh-authorized-key-with-changed-ssh-port%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
You can specify a non-default port on the ssh
client command line using the -p
option. From man ssh
:
-p port
Port to connect to on the remote host. This can be specified on
a per-host basis in the configuration file.
You may wish to put both the port number and the identity file location for the host in a ~/.ssh/config
file so that they don't need to be specified every time on the command line.
Ex.
Host myremotehost
Hostname 555.555.555.555
User user
Port 20002
IdentityFile /Users/myuser/.ssh/vpsssh
Then you will be able to use:
ssh myremotehost
add a comment |
You can specify a non-default port on the ssh
client command line using the -p
option. From man ssh
:
-p port
Port to connect to on the remote host. This can be specified on
a per-host basis in the configuration file.
You may wish to put both the port number and the identity file location for the host in a ~/.ssh/config
file so that they don't need to be specified every time on the command line.
Ex.
Host myremotehost
Hostname 555.555.555.555
User user
Port 20002
IdentityFile /Users/myuser/.ssh/vpsssh
Then you will be able to use:
ssh myremotehost
add a comment |
You can specify a non-default port on the ssh
client command line using the -p
option. From man ssh
:
-p port
Port to connect to on the remote host. This can be specified on
a per-host basis in the configuration file.
You may wish to put both the port number and the identity file location for the host in a ~/.ssh/config
file so that they don't need to be specified every time on the command line.
Ex.
Host myremotehost
Hostname 555.555.555.555
User user
Port 20002
IdentityFile /Users/myuser/.ssh/vpsssh
Then you will be able to use:
ssh myremotehost
You can specify a non-default port on the ssh
client command line using the -p
option. From man ssh
:
-p port
Port to connect to on the remote host. This can be specified on
a per-host basis in the configuration file.
You may wish to put both the port number and the identity file location for the host in a ~/.ssh/config
file so that they don't need to be specified every time on the command line.
Ex.
Host myremotehost
Hostname 555.555.555.555
User user
Port 20002
IdentityFile /Users/myuser/.ssh/vpsssh
Then you will be able to use:
ssh myremotehost
edited 2 hours ago
pa4080
13.8k52564
13.8k52564
answered 2 hours ago
steeldriversteeldriver
66.7k11107179
66.7k11107179
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1111994%2flogin-with-ssh-authorized-key-with-changed-ssh-port%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
1
Server and client do not about each other automatically. They both use the default port 22, unles is changed, on
sshd_config
for server, or specified on command for cliente like here– bistoco
2 hours ago
3
Possible duplicate of How to connect to a certain port on SSH
– pa4080
2 hours ago
IMO, this question is not about Ubuntu at all:
/Users/...
must be/home/...
– pa4080
2 hours ago
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
50 mins ago