1

I am trying to copy my public key on a VPS.

After I connect I run the following

xclip -sel clip < ~/.ssh/id_rsa.pub

Xclip gives me a can't open display error.

Right now I manually open the file and copy the key. There has to be a better, faster way to do this.

1
  • 1
    Headless servers don't have a clipboard which xclip could access. And even if they had one, the data would go to the server's clipboard and not the one on your client machine, which I guess is what you want. Use e.g. scp instead to copy files from a remote server to your local machine or another server directly over ssh. – Byte Commander Oct 29 '18 at 14:43
1

I guess the best way copy pub key to remote host is use ssh-copy-id:

ssh-copy-id -i ~/.ssh/mykey user@host

Not the answer you're looking for? Browse other questions tagged or ask your own question.