本文介绍了错误:Can't open display: (null) when using Xclip to copy ssh public key的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注生成 SSH 密钥,它说

sudo apt-get install xclip

下载并安装 xclip.如果您没有 apt-get,您可能需要使用其他安装程序(例如 yum)

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

xclip -sel 剪辑 <~/.ssh/id_rsa.pub

将 id_rsa.pub 文件的内容复制到剪贴板

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

但是在我运行后xclip -sel clip <~/.ssh/id_rsa.pub 我得到 Error: Can't open display: (null)问题是什么?我用谷歌搜索,但一无所获

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

推荐答案

DISPLAY=:0 xclip -sel clip <~/.ssh/id_rsa.pub 对我不起作用(ubuntu 14.04),但你可以使用:

DISPLAY=:0 xclip -sel clip < ~/.ssh/id_rsa.pub didn't work for me (ubuntu 14.04), but you can use :

cat ~/.ssh/id_rsa.pub

获取你的公钥

这篇关于错误:Can't open display: (null) when using Xclip to copy ssh public key的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 15:50