How to get public ssh key from headless Ubuntu Server (no gui) to github deploy key












0















I have built a headless Ubuntu Server 18.04 (without GUI). This is a simulated environment built in VirtualBox meant to simulate a production scenario that I am faced with configuring very soon. The production environment will be remote and accessed via a VPN. Please note that VirtualBox is not part of the production scenario.



I have created a private/public ssh key pair for using in GitHub so I can add a new deploy key



I need to be able to get a copy of the public key to add to GitHub.



There is no clipboard with a headless server via terminal. I tried installing and configuring xclip/xsel to behave like pbcopy/pbpaste. This works great on Ubuntu with a GUI but doesn't work on a headless server via terminal.



Trying to use xclip like this:



DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub


results in:



Error: Can't open display: :0


I tried getting OpenSSH up and running. I'm not an SSH guru and haven't gotten that to work.



Are there any other ways to get that ssh public key from the headless server? It is a remote server with no physical access.










share|improve this question







New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • @pa4080 this is not a duplicate, I am asking to find a way to copy the contents of the public key from the headless server's terminal (no clipboard). The question you are referring to doesn't explain how to do that.

    – joshblair
    11 hours ago
















0















I have built a headless Ubuntu Server 18.04 (without GUI). This is a simulated environment built in VirtualBox meant to simulate a production scenario that I am faced with configuring very soon. The production environment will be remote and accessed via a VPN. Please note that VirtualBox is not part of the production scenario.



I have created a private/public ssh key pair for using in GitHub so I can add a new deploy key



I need to be able to get a copy of the public key to add to GitHub.



There is no clipboard with a headless server via terminal. I tried installing and configuring xclip/xsel to behave like pbcopy/pbpaste. This works great on Ubuntu with a GUI but doesn't work on a headless server via terminal.



Trying to use xclip like this:



DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub


results in:



Error: Can't open display: :0


I tried getting OpenSSH up and running. I'm not an SSH guru and haven't gotten that to work.



Are there any other ways to get that ssh public key from the headless server? It is a remote server with no physical access.










share|improve this question







New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • @pa4080 this is not a duplicate, I am asking to find a way to copy the contents of the public key from the headless server's terminal (no clipboard). The question you are referring to doesn't explain how to do that.

    – joshblair
    11 hours ago














0












0








0








I have built a headless Ubuntu Server 18.04 (without GUI). This is a simulated environment built in VirtualBox meant to simulate a production scenario that I am faced with configuring very soon. The production environment will be remote and accessed via a VPN. Please note that VirtualBox is not part of the production scenario.



I have created a private/public ssh key pair for using in GitHub so I can add a new deploy key



I need to be able to get a copy of the public key to add to GitHub.



There is no clipboard with a headless server via terminal. I tried installing and configuring xclip/xsel to behave like pbcopy/pbpaste. This works great on Ubuntu with a GUI but doesn't work on a headless server via terminal.



Trying to use xclip like this:



DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub


results in:



Error: Can't open display: :0


I tried getting OpenSSH up and running. I'm not an SSH guru and haven't gotten that to work.



Are there any other ways to get that ssh public key from the headless server? It is a remote server with no physical access.










share|improve this question







New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have built a headless Ubuntu Server 18.04 (without GUI). This is a simulated environment built in VirtualBox meant to simulate a production scenario that I am faced with configuring very soon. The production environment will be remote and accessed via a VPN. Please note that VirtualBox is not part of the production scenario.



I have created a private/public ssh key pair for using in GitHub so I can add a new deploy key



I need to be able to get a copy of the public key to add to GitHub.



There is no clipboard with a headless server via terminal. I tried installing and configuring xclip/xsel to behave like pbcopy/pbpaste. This works great on Ubuntu with a GUI but doesn't work on a headless server via terminal.



Trying to use xclip like this:



DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub


results in:



Error: Can't open display: :0


I tried getting OpenSSH up and running. I'm not an SSH guru and haven't gotten that to work.



Are there any other ways to get that ssh public key from the headless server? It is a remote server with no physical access.







server 18.04 virtualbox ssh github






share|improve this question







New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 12 hours ago









joshblairjoshblair

101




101




New contributor




joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






joshblair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • @pa4080 this is not a duplicate, I am asking to find a way to copy the contents of the public key from the headless server's terminal (no clipboard). The question you are referring to doesn't explain how to do that.

    – joshblair
    11 hours ago



















  • @pa4080 this is not a duplicate, I am asking to find a way to copy the contents of the public key from the headless server's terminal (no clipboard). The question you are referring to doesn't explain how to do that.

    – joshblair
    11 hours ago

















@pa4080 this is not a duplicate, I am asking to find a way to copy the contents of the public key from the headless server's terminal (no clipboard). The question you are referring to doesn't explain how to do that.

– joshblair
11 hours ago





@pa4080 this is not a duplicate, I am asking to find a way to copy the contents of the public key from the headless server's terminal (no clipboard). The question you are referring to doesn't explain how to do that.

– joshblair
11 hours ago










1 Answer
1






active

oldest

votes


















2














In the normal circumstances you will be able to access your remote Ubuntu server via SSH. For this purposes, on your desktop machine, you will use a terminal emulator as gnome-terminal (on Ubuntu) or PuTTY (on Windows), etc. So you will be able to do cat id_rsa.pub, then copy the content of the key from the terminal window in use and paste it in the Key field in your browser's window.



Further reading: How do I setup SSH key based authentication for GitHub by using ~/.ssh/config file?






share|improve this answer





















  • 1





    If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

    – steeldriver
    11 hours ago











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
});


}
});






joshblair is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1123007%2fhow-to-get-public-ssh-key-from-headless-ubuntu-server-no-gui-to-github-deploy%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









2














In the normal circumstances you will be able to access your remote Ubuntu server via SSH. For this purposes, on your desktop machine, you will use a terminal emulator as gnome-terminal (on Ubuntu) or PuTTY (on Windows), etc. So you will be able to do cat id_rsa.pub, then copy the content of the key from the terminal window in use and paste it in the Key field in your browser's window.



Further reading: How do I setup SSH key based authentication for GitHub by using ~/.ssh/config file?






share|improve this answer





















  • 1





    If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

    – steeldriver
    11 hours ago
















2














In the normal circumstances you will be able to access your remote Ubuntu server via SSH. For this purposes, on your desktop machine, you will use a terminal emulator as gnome-terminal (on Ubuntu) or PuTTY (on Windows), etc. So you will be able to do cat id_rsa.pub, then copy the content of the key from the terminal window in use and paste it in the Key field in your browser's window.



Further reading: How do I setup SSH key based authentication for GitHub by using ~/.ssh/config file?






share|improve this answer





















  • 1





    If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

    – steeldriver
    11 hours ago














2












2








2







In the normal circumstances you will be able to access your remote Ubuntu server via SSH. For this purposes, on your desktop machine, you will use a terminal emulator as gnome-terminal (on Ubuntu) or PuTTY (on Windows), etc. So you will be able to do cat id_rsa.pub, then copy the content of the key from the terminal window in use and paste it in the Key field in your browser's window.



Further reading: How do I setup SSH key based authentication for GitHub by using ~/.ssh/config file?






share|improve this answer















In the normal circumstances you will be able to access your remote Ubuntu server via SSH. For this purposes, on your desktop machine, you will use a terminal emulator as gnome-terminal (on Ubuntu) or PuTTY (on Windows), etc. So you will be able to do cat id_rsa.pub, then copy the content of the key from the terminal window in use and paste it in the Key field in your browser's window.



Further reading: How do I setup SSH key based authentication for GitHub by using ~/.ssh/config file?







share|improve this answer














share|improve this answer



share|improve this answer








edited 11 hours ago

























answered 12 hours ago









pa4080pa4080

14.4k52670




14.4k52670








  • 1





    If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

    – steeldriver
    11 hours ago














  • 1





    If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

    – steeldriver
    11 hours ago








1




1





If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

– steeldriver
11 hours ago





If you're using the VirualBox console directly (rather than a 3rd party terminal session such as PuTTY), it should be possible to copy the terminal output from guest to host via shared clipboard, so long as Guest Additions are installed

– steeldriver
11 hours ago










joshblair is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















joshblair is a new contributor. Be nice, and check out our Code of Conduct.













joshblair is a new contributor. Be nice, and check out our Code of Conduct.












joshblair is a new contributor. Be nice, and check out our Code of Conduct.
















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1123007%2fhow-to-get-public-ssh-key-from-headless-ubuntu-server-no-gui-to-github-deploy%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

How did Captain America manage to do this?

迪纳利

南乌拉尔铁路局