ssh connection error “Permission denied (publickey)”
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
So I have been trying to build ssh connections between google cluster container containing 1 master node and 2 worker nodes. I have used ssh-keygen to generate key pairs for all three nodes, send the two private keys of the 2 workers to the master node and into the .ssh/autherized_keys file. Then I shared this file with the two worker nodes too.
This approach makes successful ssh connections right after. The ssh connection was fine and I could also use scp to send over files. Yet as in later stages as I logout and re-login into the VMs, the ssh connection became very unstable, as sometimes it returns connection failure error : Permission denied (publickey), while sometimes the connection could be again triggered.
Anyone knows what the problem is? Thanks in advance!
linux networking ssh permissions cluster
add a comment |
So I have been trying to build ssh connections between google cluster container containing 1 master node and 2 worker nodes. I have used ssh-keygen to generate key pairs for all three nodes, send the two private keys of the 2 workers to the master node and into the .ssh/autherized_keys file. Then I shared this file with the two worker nodes too.
This approach makes successful ssh connections right after. The ssh connection was fine and I could also use scp to send over files. Yet as in later stages as I logout and re-login into the VMs, the ssh connection became very unstable, as sometimes it returns connection failure error : Permission denied (publickey), while sometimes the connection could be again triggered.
Anyone knows what the problem is? Thanks in advance!
linux networking ssh permissions cluster
1
More info is needed to properly diagnose this. What's the output ofssh -v thehostnameyouwanttoconnectto.com
?
– Jarmund
May 24 '15 at 18:54
add a comment |
So I have been trying to build ssh connections between google cluster container containing 1 master node and 2 worker nodes. I have used ssh-keygen to generate key pairs for all three nodes, send the two private keys of the 2 workers to the master node and into the .ssh/autherized_keys file. Then I shared this file with the two worker nodes too.
This approach makes successful ssh connections right after. The ssh connection was fine and I could also use scp to send over files. Yet as in later stages as I logout and re-login into the VMs, the ssh connection became very unstable, as sometimes it returns connection failure error : Permission denied (publickey), while sometimes the connection could be again triggered.
Anyone knows what the problem is? Thanks in advance!
linux networking ssh permissions cluster
So I have been trying to build ssh connections between google cluster container containing 1 master node and 2 worker nodes. I have used ssh-keygen to generate key pairs for all three nodes, send the two private keys of the 2 workers to the master node and into the .ssh/autherized_keys file. Then I shared this file with the two worker nodes too.
This approach makes successful ssh connections right after. The ssh connection was fine and I could also use scp to send over files. Yet as in later stages as I logout and re-login into the VMs, the ssh connection became very unstable, as sometimes it returns connection failure error : Permission denied (publickey), while sometimes the connection could be again triggered.
Anyone knows what the problem is? Thanks in advance!
linux networking ssh permissions cluster
linux networking ssh permissions cluster
asked May 24 '15 at 18:43
bcxuezhe39bcxuezhe39
613
613
1
More info is needed to properly diagnose this. What's the output ofssh -v thehostnameyouwanttoconnectto.com
?
– Jarmund
May 24 '15 at 18:54
add a comment |
1
More info is needed to properly diagnose this. What's the output ofssh -v thehostnameyouwanttoconnectto.com
?
– Jarmund
May 24 '15 at 18:54
1
1
More info is needed to properly diagnose this. What's the output of
ssh -v thehostnameyouwanttoconnectto.com
?– Jarmund
May 24 '15 at 18:54
More info is needed to properly diagnose this. What's the output of
ssh -v thehostnameyouwanttoconnectto.com
?– Jarmund
May 24 '15 at 18:54
add a comment |
1 Answer
1
active
oldest
votes
If it was working at one point and isn't now, do:
# Adjust paths as necessary. May need to add sudo if you're not running it as root.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/authorized_keys
If still no love, verify contents of authorized_keys, and check the following values in /etc/ssh/sshd_config (or whatever your sshd config file is.) This will disable password auth, and enable ssh only authentication against the system.
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
UsePAM no # Just my choice.
Secuirty Note: I recommend using a password protected private key when accessing your cloud environment, and only setting this up against a single system, a jump server. From there you can more confidently utilize passwordless ssh authentication to the rest of your environment.
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
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%2f918980%2fssh-connection-error-permission-denied-publickey%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
If it was working at one point and isn't now, do:
# Adjust paths as necessary. May need to add sudo if you're not running it as root.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/authorized_keys
If still no love, verify contents of authorized_keys, and check the following values in /etc/ssh/sshd_config (or whatever your sshd config file is.) This will disable password auth, and enable ssh only authentication against the system.
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
UsePAM no # Just my choice.
Secuirty Note: I recommend using a password protected private key when accessing your cloud environment, and only setting this up against a single system, a jump server. From there you can more confidently utilize passwordless ssh authentication to the rest of your environment.
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
add a comment |
If it was working at one point and isn't now, do:
# Adjust paths as necessary. May need to add sudo if you're not running it as root.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/authorized_keys
If still no love, verify contents of authorized_keys, and check the following values in /etc/ssh/sshd_config (or whatever your sshd config file is.) This will disable password auth, and enable ssh only authentication against the system.
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
UsePAM no # Just my choice.
Secuirty Note: I recommend using a password protected private key when accessing your cloud environment, and only setting this up against a single system, a jump server. From there you can more confidently utilize passwordless ssh authentication to the rest of your environment.
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
add a comment |
If it was working at one point and isn't now, do:
# Adjust paths as necessary. May need to add sudo if you're not running it as root.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/authorized_keys
If still no love, verify contents of authorized_keys, and check the following values in /etc/ssh/sshd_config (or whatever your sshd config file is.) This will disable password auth, and enable ssh only authentication against the system.
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
UsePAM no # Just my choice.
Secuirty Note: I recommend using a password protected private key when accessing your cloud environment, and only setting this up against a single system, a jump server. From there you can more confidently utilize passwordless ssh authentication to the rest of your environment.
If it was working at one point and isn't now, do:
# Adjust paths as necessary. May need to add sudo if you're not running it as root.
chmod 700 ~/.ssh && chmod 600 ~/.ssh/* && chmod 644 ~/.ssh/authorized_keys
If still no love, verify contents of authorized_keys, and check the following values in /etc/ssh/sshd_config (or whatever your sshd config file is.) This will disable password auth, and enable ssh only authentication against the system.
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
UsePAM no # Just my choice.
Secuirty Note: I recommend using a password protected private key when accessing your cloud environment, and only setting this up against a single system, a jump server. From there you can more confidently utilize passwordless ssh authentication to the rest of your environment.
answered May 25 '15 at 11:56
Alex AtkinsonAlex Atkinson
2,735913
2,735913
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
add a comment |
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
Thanks for the reply! I have checked the sshd_config, and even has further changed to allow empty password (which was set to no). Yet the connection is still not stable. By not stable, it can always connect successfully upon the first logging in, but after a few minutes (even without any interleaving commands), the ssh command then becomes not working (while the same ssh command as one previously executed command works).
– bcxuezhe39
May 25 '15 at 15:13
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%2f918980%2fssh-connection-error-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
1
More info is needed to properly diagnose this. What's the output of
ssh -v thehostnameyouwanttoconnectto.com
?– Jarmund
May 24 '15 at 18:54