Login with SSH authorized key with changed SSH port
Clash Royale CLAN TAG#URR8PPP
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
2
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
Jan 22 at 15:35
1
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
Jan 22 at 17:13
Is there a reason you're using a different key for each host you connect to?
– R..
Jan 23 at 17:41
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 Jan 22 at 15:32
user1048676user1048676
1525
1525
2
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
Jan 22 at 15:35
1
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
Jan 22 at 17:13
Is there a reason you're using a different key for each host you connect to?
– R..
Jan 23 at 17:41
add a comment |
2
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
Jan 22 at 15:35
1
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
Jan 22 at 17:13
Is there a reason you're using a different key for each host you connect to?
– R..
Jan 23 at 17:41
2
2
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
Jan 22 at 15:35
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
Jan 22 at 15:35
1
1
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
Jan 22 at 17:13
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
Jan 22 at 17:13
Is there a reason you're using a different key for each host you connect to?
– R..
Jan 23 at 17:41
Is there a reason you're using a different key for each host you connect to?
– R..
Jan 23 at 17:41
add a comment |
2 Answers
2
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
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
add a comment |
Note that ssh
accepts commands in the URI form, such as ssh://user@host.com:<port>
. Based on that, what I do when logging in to a remote server with a private key is the following:
ssh -i ~/.ssh/id_rsa ssh://myuser@domain_name.com:2222
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
2 Answers
2
active
oldest
votes
2 Answers
2
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
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
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
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
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 Jan 22 at 15:43
pa4080
14.1k52666
14.1k52666
answered Jan 22 at 15:35
steeldriversteeldriver
67.5k11110181
67.5k11110181
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
add a comment |
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
Probably useful to many when you start defining that kind of configuration: How do I configure SSH so it dosen't try all the identity files automatically?.
– Giacomo Alzetta
Jan 23 at 14:46
add a comment |
Note that ssh
accepts commands in the URI form, such as ssh://user@host.com:<port>
. Based on that, what I do when logging in to a remote server with a private key is the following:
ssh -i ~/.ssh/id_rsa ssh://myuser@domain_name.com:2222
add a comment |
Note that ssh
accepts commands in the URI form, such as ssh://user@host.com:<port>
. Based on that, what I do when logging in to a remote server with a private key is the following:
ssh -i ~/.ssh/id_rsa ssh://myuser@domain_name.com:2222
add a comment |
Note that ssh
accepts commands in the URI form, such as ssh://user@host.com:<port>
. Based on that, what I do when logging in to a remote server with a private key is the following:
ssh -i ~/.ssh/id_rsa ssh://myuser@domain_name.com:2222
Note that ssh
accepts commands in the URI form, such as ssh://user@host.com:<port>
. Based on that, what I do when logging in to a remote server with a private key is the following:
ssh -i ~/.ssh/id_rsa ssh://myuser@domain_name.com:2222
answered Jan 23 at 1:30
Sergiy KolodyazhnyySergiy Kolodyazhnyy
71.9k9148314
71.9k9148314
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
2
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
Jan 22 at 15:35
1
They could be trying to login to an Ubuntu server from a Windows PC, which I think is still on topic.
– Arronical
Jan 22 at 17:13
Is there a reason you're using a different key for each host you connect to?
– R..
Jan 23 at 17:41