SSH server Permission denied (publickey)
In the past I set up an ssh server with pubkey-only authentication on a kali linux, and it worked, but now I am on Ubuntu 18.10 and it won't work. When I try to connect with client I get: Permission denied (publickey)
Usually, on kali, I'd use ssh tunneling service serveo.net with the following command successfuly:
ssh -R crayyhost:22:localhost:1337 serveo.net
And I'd connect to the server like this: ssh -J serveo.net auser@crayyhost
But here I simply can't. I cant connect to myself... The server is on ubuntu and the client is on kali.
I can't even connect with ssh auser@EXTERNAL_IP -p 1337
- I get "Connection refused".
The same goes for LAN: ssh auser@192.168.1.2 -p 1337
- "Permission denied"
The server can connect to himself with ssh localhost -p 1337
, and the server can even connect to himself remotely with ssh -J serveo.net auser@crayyhost
, but the client can't.
The client's id_rsa.pub
file has been added to .ssh/authorized_keys
I even disabled StrictMode
in sshd_config
ubuntu ssh
add a comment |
In the past I set up an ssh server with pubkey-only authentication on a kali linux, and it worked, but now I am on Ubuntu 18.10 and it won't work. When I try to connect with client I get: Permission denied (publickey)
Usually, on kali, I'd use ssh tunneling service serveo.net with the following command successfuly:
ssh -R crayyhost:22:localhost:1337 serveo.net
And I'd connect to the server like this: ssh -J serveo.net auser@crayyhost
But here I simply can't. I cant connect to myself... The server is on ubuntu and the client is on kali.
I can't even connect with ssh auser@EXTERNAL_IP -p 1337
- I get "Connection refused".
The same goes for LAN: ssh auser@192.168.1.2 -p 1337
- "Permission denied"
The server can connect to himself with ssh localhost -p 1337
, and the server can even connect to himself remotely with ssh -J serveo.net auser@crayyhost
, but the client can't.
The client's id_rsa.pub
file has been added to .ssh/authorized_keys
I even disabled StrictMode
in sshd_config
ubuntu ssh
add a comment |
In the past I set up an ssh server with pubkey-only authentication on a kali linux, and it worked, but now I am on Ubuntu 18.10 and it won't work. When I try to connect with client I get: Permission denied (publickey)
Usually, on kali, I'd use ssh tunneling service serveo.net with the following command successfuly:
ssh -R crayyhost:22:localhost:1337 serveo.net
And I'd connect to the server like this: ssh -J serveo.net auser@crayyhost
But here I simply can't. I cant connect to myself... The server is on ubuntu and the client is on kali.
I can't even connect with ssh auser@EXTERNAL_IP -p 1337
- I get "Connection refused".
The same goes for LAN: ssh auser@192.168.1.2 -p 1337
- "Permission denied"
The server can connect to himself with ssh localhost -p 1337
, and the server can even connect to himself remotely with ssh -J serveo.net auser@crayyhost
, but the client can't.
The client's id_rsa.pub
file has been added to .ssh/authorized_keys
I even disabled StrictMode
in sshd_config
ubuntu ssh
In the past I set up an ssh server with pubkey-only authentication on a kali linux, and it worked, but now I am on Ubuntu 18.10 and it won't work. When I try to connect with client I get: Permission denied (publickey)
Usually, on kali, I'd use ssh tunneling service serveo.net with the following command successfuly:
ssh -R crayyhost:22:localhost:1337 serveo.net
And I'd connect to the server like this: ssh -J serveo.net auser@crayyhost
But here I simply can't. I cant connect to myself... The server is on ubuntu and the client is on kali.
I can't even connect with ssh auser@EXTERNAL_IP -p 1337
- I get "Connection refused".
The same goes for LAN: ssh auser@192.168.1.2 -p 1337
- "Permission denied"
The server can connect to himself with ssh localhost -p 1337
, and the server can even connect to himself remotely with ssh -J serveo.net auser@crayyhost
, but the client can't.
The client's id_rsa.pub
file has been added to .ssh/authorized_keys
I even disabled StrictMode
in sshd_config
ubuntu ssh
ubuntu ssh
edited Jan 8 at 20:14
MyWays
asked Jan 8 at 20:05
MyWaysMyWays
225
225
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
"Connection refused" means there's probably a firewall in the way. Try running telnet 1337
to verify that the port is at least accessible from where you're trying to connect.
"Permission denied" for ssh auser@192.168.1.2 -p 1337
suggests that, besides a firewall, your public key isn't properly installed. if you have added the .pub key to the correct directory, maybe try restarting the ssh service to make sure it picks it up.
other than that, double check everything that's listed in the answer to this question: https://askubuntu.com/questions/46424/how-do-i-add-ssh-keys-to-authorized-keys-file
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
add a comment |
You may need to specify your private key.
Use ssh -i <private key path> user@server -p 1337
For example if you are in the directory with your private key thats copied directly to your machine, you could use ssh -i id_rsa auser@192.168.1.XX -p 1337
. This tells it to use a private key that you have specified.
You could also research on how to add this to the config file in ~/.ssh to automate it, as well as the port.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1392015%2fssh-server-permission-denied-publickey%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
"Connection refused" means there's probably a firewall in the way. Try running telnet 1337
to verify that the port is at least accessible from where you're trying to connect.
"Permission denied" for ssh auser@192.168.1.2 -p 1337
suggests that, besides a firewall, your public key isn't properly installed. if you have added the .pub key to the correct directory, maybe try restarting the ssh service to make sure it picks it up.
other than that, double check everything that's listed in the answer to this question: https://askubuntu.com/questions/46424/how-do-i-add-ssh-keys-to-authorized-keys-file
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
add a comment |
"Connection refused" means there's probably a firewall in the way. Try running telnet 1337
to verify that the port is at least accessible from where you're trying to connect.
"Permission denied" for ssh auser@192.168.1.2 -p 1337
suggests that, besides a firewall, your public key isn't properly installed. if you have added the .pub key to the correct directory, maybe try restarting the ssh service to make sure it picks it up.
other than that, double check everything that's listed in the answer to this question: https://askubuntu.com/questions/46424/how-do-i-add-ssh-keys-to-authorized-keys-file
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
add a comment |
"Connection refused" means there's probably a firewall in the way. Try running telnet 1337
to verify that the port is at least accessible from where you're trying to connect.
"Permission denied" for ssh auser@192.168.1.2 -p 1337
suggests that, besides a firewall, your public key isn't properly installed. if you have added the .pub key to the correct directory, maybe try restarting the ssh service to make sure it picks it up.
other than that, double check everything that's listed in the answer to this question: https://askubuntu.com/questions/46424/how-do-i-add-ssh-keys-to-authorized-keys-file
"Connection refused" means there's probably a firewall in the way. Try running telnet 1337
to verify that the port is at least accessible from where you're trying to connect.
"Permission denied" for ssh auser@192.168.1.2 -p 1337
suggests that, besides a firewall, your public key isn't properly installed. if you have added the .pub key to the correct directory, maybe try restarting the ssh service to make sure it picks it up.
other than that, double check everything that's listed in the answer to this question: https://askubuntu.com/questions/46424/how-do-i-add-ssh-keys-to-authorized-keys-file
answered Jan 8 at 20:13
blueberryfieldsblueberryfields
5641723
5641723
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
add a comment |
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
Weird. I re-created the client rsa key 3 times by now and re-added it and it wouldn't work. I'd restart ssh every time. Now I added a pubkey to authorized_keys without deleting the old one and it worked. (Now there's 1 current and 1 outdated rsa key of that client)
– MyWays
Jan 8 at 20:26
add a comment |
You may need to specify your private key.
Use ssh -i <private key path> user@server -p 1337
For example if you are in the directory with your private key thats copied directly to your machine, you could use ssh -i id_rsa auser@192.168.1.XX -p 1337
. This tells it to use a private key that you have specified.
You could also research on how to add this to the config file in ~/.ssh to automate it, as well as the port.
add a comment |
You may need to specify your private key.
Use ssh -i <private key path> user@server -p 1337
For example if you are in the directory with your private key thats copied directly to your machine, you could use ssh -i id_rsa auser@192.168.1.XX -p 1337
. This tells it to use a private key that you have specified.
You could also research on how to add this to the config file in ~/.ssh to automate it, as well as the port.
add a comment |
You may need to specify your private key.
Use ssh -i <private key path> user@server -p 1337
For example if you are in the directory with your private key thats copied directly to your machine, you could use ssh -i id_rsa auser@192.168.1.XX -p 1337
. This tells it to use a private key that you have specified.
You could also research on how to add this to the config file in ~/.ssh to automate it, as well as the port.
You may need to specify your private key.
Use ssh -i <private key path> user@server -p 1337
For example if you are in the directory with your private key thats copied directly to your machine, you could use ssh -i id_rsa auser@192.168.1.XX -p 1337
. This tells it to use a private key that you have specified.
You could also research on how to add this to the config file in ~/.ssh to automate it, as well as the port.
answered Jan 8 at 20:15
QuickishFMQuickishFM
1966
1966
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1392015%2fssh-server-permission-denied-publickey%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