Am I using my SSH keys correctly?
I recently created my keypair via ssh-keygen -t rsa -f ~/.ssh/my_keyname -C pebaken
So I looked into my .ssh folder located in my home user directory and found 2 keys one my_keyname.pub and my_keyname as well as a folder called 'authorized_keys.'
I tried using the public key my_keyname.pub while connecting to my VM I got > Disconnected: No supported authentication methods available (server sent: publickey)
I thought the public key was suppose to be the one you kept and the private key would stay on the server?
I then tried the key without any extension, put it in puttygen and immediately got > Successfully imported foreign key (OpenSSH SSH-2 private key (old PEM format)). To use this key with Putty, you need to use the "Save private" command to save it in Puttys own format.
So am I using the private key after all, because it worked and I successfully connected to my VM.
ubuntu ssh
New contributor
add a comment |
I recently created my keypair via ssh-keygen -t rsa -f ~/.ssh/my_keyname -C pebaken
So I looked into my .ssh folder located in my home user directory and found 2 keys one my_keyname.pub and my_keyname as well as a folder called 'authorized_keys.'
I tried using the public key my_keyname.pub while connecting to my VM I got > Disconnected: No supported authentication methods available (server sent: publickey)
I thought the public key was suppose to be the one you kept and the private key would stay on the server?
I then tried the key without any extension, put it in puttygen and immediately got > Successfully imported foreign key (OpenSSH SSH-2 private key (old PEM format)). To use this key with Putty, you need to use the "Save private" command to save it in Puttys own format.
So am I using the private key after all, because it worked and I successfully connected to my VM.
ubuntu ssh
New contributor
add a comment |
I recently created my keypair via ssh-keygen -t rsa -f ~/.ssh/my_keyname -C pebaken
So I looked into my .ssh folder located in my home user directory and found 2 keys one my_keyname.pub and my_keyname as well as a folder called 'authorized_keys.'
I tried using the public key my_keyname.pub while connecting to my VM I got > Disconnected: No supported authentication methods available (server sent: publickey)
I thought the public key was suppose to be the one you kept and the private key would stay on the server?
I then tried the key without any extension, put it in puttygen and immediately got > Successfully imported foreign key (OpenSSH SSH-2 private key (old PEM format)). To use this key with Putty, you need to use the "Save private" command to save it in Puttys own format.
So am I using the private key after all, because it worked and I successfully connected to my VM.
ubuntu ssh
New contributor
I recently created my keypair via ssh-keygen -t rsa -f ~/.ssh/my_keyname -C pebaken
So I looked into my .ssh folder located in my home user directory and found 2 keys one my_keyname.pub and my_keyname as well as a folder called 'authorized_keys.'
I tried using the public key my_keyname.pub while connecting to my VM I got > Disconnected: No supported authentication methods available (server sent: publickey)
I thought the public key was suppose to be the one you kept and the private key would stay on the server?
I then tried the key without any extension, put it in puttygen and immediately got > Successfully imported foreign key (OpenSSH SSH-2 private key (old PEM format)). To use this key with Putty, you need to use the "Save private" command to save it in Puttys own format.
So am I using the private key after all, because it worked and I successfully connected to my VM.
ubuntu ssh
ubuntu ssh
New contributor
New contributor
New contributor
asked 5 hours ago
PebakenPebaken
1
1
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The public key is for copying to ~/.ssh/authorized_keys
(which is a file, not a directory) on the remote hosts you will be connecting to.
The private key is for connecting with from your local system.
Related:
- How to ssh to remote server using a private key?
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed insideauthorized_keys
. The client authenticates the server viaknown_hosts
– jdwolf
1 hour ago
add a comment |
It's in the name.
The private key is the one you keep to yourself, never share this with anyone and ideally keep it encrypted with a passphrase.
The public key can be distributed anywhere, you can publish it in plain text anywhere.
The public key needs to go on the remote server to confirm you have an appropriate key, the private key should never leave your local environment.
The public key can be derived from the private key.
When authenticating your ssh client will offer a public key (which it will derive from the local public key) to the remote server. The server will confirm that public key is able to authenticate to it and offer a challenge that will not be answerable unless you have the private key. Your client answers the challenge with your private key and the remote server lets you login.
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});
}
});
Pebaken is a new contributor. Be nice, and check out our Code of Conduct.
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%2funix.stackexchange.com%2fquestions%2f505401%2fam-i-using-my-ssh-keys-correctly%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
The public key is for copying to ~/.ssh/authorized_keys
(which is a file, not a directory) on the remote hosts you will be connecting to.
The private key is for connecting with from your local system.
Related:
- How to ssh to remote server using a private key?
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed insideauthorized_keys
. The client authenticates the server viaknown_hosts
– jdwolf
1 hour ago
add a comment |
The public key is for copying to ~/.ssh/authorized_keys
(which is a file, not a directory) on the remote hosts you will be connecting to.
The private key is for connecting with from your local system.
Related:
- How to ssh to remote server using a private key?
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed insideauthorized_keys
. The client authenticates the server viaknown_hosts
– jdwolf
1 hour ago
add a comment |
The public key is for copying to ~/.ssh/authorized_keys
(which is a file, not a directory) on the remote hosts you will be connecting to.
The private key is for connecting with from your local system.
Related:
- How to ssh to remote server using a private key?
The public key is for copying to ~/.ssh/authorized_keys
(which is a file, not a directory) on the remote hosts you will be connecting to.
The private key is for connecting with from your local system.
Related:
- How to ssh to remote server using a private key?
answered 5 hours ago
KusalanandaKusalananda
134k17255418
134k17255418
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed insideauthorized_keys
. The client authenticates the server viaknown_hosts
– jdwolf
1 hour ago
add a comment |
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed insideauthorized_keys
. The client authenticates the server viaknown_hosts
– jdwolf
1 hour ago
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
Sorry I did mean file, not folder.I'm confused as initially, I believed you needed the public key to access a VM from the outside? The private key would stay on the server.
– Pebaken
5 hours ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed inside
authorized_keys
. The client authenticates the server via known_hosts
– jdwolf
1 hour ago
@Pebaken The public key is used to prove you possess the private key thus confirming you are authorized so long as your public key is listed inside
authorized_keys
. The client authenticates the server via known_hosts
– jdwolf
1 hour ago
add a comment |
It's in the name.
The private key is the one you keep to yourself, never share this with anyone and ideally keep it encrypted with a passphrase.
The public key can be distributed anywhere, you can publish it in plain text anywhere.
The public key needs to go on the remote server to confirm you have an appropriate key, the private key should never leave your local environment.
The public key can be derived from the private key.
When authenticating your ssh client will offer a public key (which it will derive from the local public key) to the remote server. The server will confirm that public key is able to authenticate to it and offer a challenge that will not be answerable unless you have the private key. Your client answers the challenge with your private key and the remote server lets you login.
New contributor
add a comment |
It's in the name.
The private key is the one you keep to yourself, never share this with anyone and ideally keep it encrypted with a passphrase.
The public key can be distributed anywhere, you can publish it in plain text anywhere.
The public key needs to go on the remote server to confirm you have an appropriate key, the private key should never leave your local environment.
The public key can be derived from the private key.
When authenticating your ssh client will offer a public key (which it will derive from the local public key) to the remote server. The server will confirm that public key is able to authenticate to it and offer a challenge that will not be answerable unless you have the private key. Your client answers the challenge with your private key and the remote server lets you login.
New contributor
add a comment |
It's in the name.
The private key is the one you keep to yourself, never share this with anyone and ideally keep it encrypted with a passphrase.
The public key can be distributed anywhere, you can publish it in plain text anywhere.
The public key needs to go on the remote server to confirm you have an appropriate key, the private key should never leave your local environment.
The public key can be derived from the private key.
When authenticating your ssh client will offer a public key (which it will derive from the local public key) to the remote server. The server will confirm that public key is able to authenticate to it and offer a challenge that will not be answerable unless you have the private key. Your client answers the challenge with your private key and the remote server lets you login.
New contributor
It's in the name.
The private key is the one you keep to yourself, never share this with anyone and ideally keep it encrypted with a passphrase.
The public key can be distributed anywhere, you can publish it in plain text anywhere.
The public key needs to go on the remote server to confirm you have an appropriate key, the private key should never leave your local environment.
The public key can be derived from the private key.
When authenticating your ssh client will offer a public key (which it will derive from the local public key) to the remote server. The server will confirm that public key is able to authenticate to it and offer a challenge that will not be answerable unless you have the private key. Your client answers the challenge with your private key and the remote server lets you login.
New contributor
New contributor
answered 1 hour ago
lytelyte
1012
1012
New contributor
New contributor
add a comment |
add a comment |
Pebaken is a new contributor. Be nice, and check out our Code of Conduct.
Pebaken is a new contributor. Be nice, and check out our Code of Conduct.
Pebaken is a new contributor. Be nice, and check out our Code of Conduct.
Pebaken is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f505401%2fam-i-using-my-ssh-keys-correctly%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