我尝试了以下命令但未成功: $> ssh-add -D 有没有办法彻底删除SSH密钥? ssh-add -d / -D 不是删除按键: Debian Bug report#472477: ssh-add -D 不会从 gnome中删除SSH密钥-keyring-daemon 内存 Ubuntu: ssh-add -D 删除所有身份不起作用,为什么所有的身份都是自动添加的? / b> 准确的问题是: ssh-add -d / -D 仅从gnome-keyring手动添加键。 Ther e是无法删除自动添加的键。 这是原始的错误,它仍然存在。 例如,if你有两个不同的自动加载的ssh身份与两个不同的GitHub账户相关联 - 比如工作和家庭 - 他们之间没有办法 进行切换。 GitHubtakes第一个匹配,所以你总是作为你的'家'用户GitHub,没有办法上传东西到工作项目。 允许 ssh-add -d 来应用到自动加载的键(和 ssh-add -t X 改变自动加载的键的生命周期),将恢复大多数用户期望的行为。 罪魁祸首是 gpg-keyring-daemon : 它颠覆了ssh-agent的正常操作,主要是为了能够弹出一个漂亮的盒子,键入加密的ssh密钥的密码。 它通过你的 .ssh 目录,并自动添加找到的所有密钥到你的代理。 它不会让你删除这些密钥。 我们如何讨厌这个?让我们不要指望的方式 - 生活太短。 失败是复杂的,因为较新的ssh客户端连接到主机时会自动尝试ssh-agent中的所有密钥。 如果服务器数量过多,服务器将拒绝连接。 由于gnome-keyring-daemon已经决定了你希望你的ssh-agent拥有多少个密钥,并且已经自动加载它们,并且不会让你删除它们,你要烤面包。 这个错误在Ubuntu 14.04中仍然得到确认.4,就在两天前(2014年8月21日) 可能的解决方法: 执行 ssh-add -D 删除所有的手动添加键。这也锁定自动添加的密钥,但没有多大用处,因为当你尝试执行 gnome-keyring 会反过来要求你解锁它们c> git push 。 导航到〜/ .ssh 文件夹并移动所有密钥文件除了您想要识别的一个名为备份的单独文件夹之外。如果有必要,你也可以打开海马并从那里删除键。 现在你应该可以在没有问题的情况下执行 git push 。 另一个解决方法: 你真正想做的是完全关闭 gpg-keyring-daemon 。 > 转至系统 - >首选项 - >启动应用程序,并取消选择 SSH密钥代理(Gnome Keyring SSH代理)框 - 您需要向下滚动才能找到它。 您仍然会得到一个 ssh-agent ,只有现在它会表现得很理智:没有键自动加载,你运行ssh-add来添加它们,如果你想删除密钥,你可以。想象一下。 此评论实际上表明: 解决方案是以保持 gnome-keyring-manager 永远不会启动,这很难通过删除程序文件的执行权限来实现。 I've currently an old SSH key uploaded on the server. The problem is I lost my ~/.ssh directory (with the original id_rsa and id_rsa.pub files).Consequently, I want to remove the old SSH key directly on the server and upload a new one.I tried the following command without success:$> ssh-add -DIs there a way to completely remove a SSH key? 解决方案 Note that there is at least two bug report for ssh-add -d/-D not removing keys:"Debian Bug report #472477: ssh-add -D does not remove SSH key from gnome-keyring-daemon memory""Ubuntu: ssh-add -D deleting all identities does not work. Also, why are all identities auto-added?"The exact issue is: ssh-add -d/-D deletes only manually added keys from gnome-keyring. There is no way to delete automatically added keys. This is the original bug, and it's still definitely present. So, for example, if you have two different automatically-loaded ssh identities associated with two different GitHub accounts -- say for work and for home -- there's no way to switch between them. GitHubtakes the first one which matches, so you always appear as your 'home' user to GitHub, with no way to upload things to work projects. Allowing ssh-add -d to apply to automatically-loaded keys (and ssh-add -t X to change the lifetime of automatically-loaded keys), would restore the behavior most users expect.More precisely, about the issue: The culprit is gpg-keyring-daemon: It subverts the normal operation of ssh-agent, mostly just so that it can pop up a pretty box into which you can type the passphrase for an encrypted ssh key. And it paws through your .ssh directory, and automatically adds any keys it finds to your agent. And it won't let you delete those keys. How do we hate this? Let's not count the ways -- life's too short. The failure is compounded because newer ssh clients automatically try all the keys in your ssh-agent when connecting to a host. If there are too many, the server will reject the connection. And since gnome-keyring-daemon has decided for itself how many keys you want your ssh-agent to have, and has autoloaded them, AND WON'T LET YOU DELETE THEM, you're toast.This bug is still confirmed in Ubuntu 14.04.4, as recently as two days ago (August 21st, 2014)A possible workaround: Do ssh-add -D to delete all your manually added keys. This also locks the automatically added keys, but is not much use since gnome-keyring will ask you to unlock them anyways when you try doing a git push. Navigate to your ~/.ssh folder and move all your key files except the one you want to identify with into a separate folder called backup. If necessary you can also open seahorse and delete the keys from there. Now you should be able to do git push without a problem.Another workaround: What you really want to do is to turn off gpg-keyring-daemon altogether. Go to System --> Preferences --> Startup Applications, and unselect the "SSH Key Agent (Gnome Keyring SSH Agent)" box -- you'll need to scroll down to find it. You'll still get an ssh-agent, only now it will behave sanely: no keys autoloaded, you run ssh-add to add them, and if you want to delete keys, you can. Imagine that.This comments actually suggests: The solution is to keep gnome-keyring-manager from ever starting up, which was strangely difficult by finally achieved by removing the program file's execute permission. 这篇关于如何删除ssh密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 06:14