Unable to copy ~/.ssh/id_rsa.pub

2020-05-11 07:21发布

I’m following in Generating SSH Keys, it says

sudo apt-get install xclip

# Downloads and installs xclip. If you don't have apt-get, you might need to use another installer (like yum)

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

# Copies the contents of the id_rsa.pub file to your clipboard

But after I runxclip -sel clip < ~/.ssh/id_rsa.pub I get Error: Can't open display: (null) What is the problem? I googled around but found nothing about it

标签: linux ssh
8条回答
唯我独甜
2楼-- · 2020-05-11 07:55

In case you are trying to use xclip on remote host just add -X to your ssh command

ssh user@host -X

More detailed information can be found here : https://askubuntu.com/a/305681

查看更多
冷血范
3楼-- · 2020-05-11 08:06

Try this and it will work like a charm. I was having the same error but this approach did the trick for me:

ssh USER@REMOTE "cat file"|xclip -i
查看更多
登录 后发表回答