惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
Microsoft Security Blog
Microsoft Security Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Vercel News
Vercel News
Application and Cybersecurity Blog
Application and Cybersecurity Blog
C
Check Point Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
The Hacker News
The Hacker News
L
LINUX DO - 热门话题
T
Tenable Blog
Hugging Face - Blog
Hugging Face - Blog
Google Online Security Blog
Google Online Security Blog
博客园 - Franky
P
Proofpoint News Feed
H
Hacker News: Front Page
P
Privacy & Cybersecurity Law Blog
月光博客
月光博客
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
博客园_首页
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
Forbes - Security
Forbes - Security
I
InfoQ
Stack Overflow Blog
Stack Overflow Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
博客园 - 叶小钗
T
Threat Research - Cisco Blogs
aimingoo的专栏
aimingoo的专栏
D
Darknet – Hacking Tools, Hacker News & Cyber Security
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Hacker News - Newest:
Hacker News - Newest: "LLM"
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
O
OpenAI News
G
Google Developers Blog
Martin Fowler
Martin Fowler
罗磊的独立博客
S
SegmentFault 最新的问题
T
Tor Project blog
量子位

青石坞

花费近万元,跑了8500km,我租车一年后的真实感受 - 青石坞 两个新手司机的端午赤峰自驾行记:邂逅草原、山雨与意外 - 青石坞 以身试局,兼职刷单到底什么套路? - 青石坞 最新版 Emby 试用 Premiere,纯原版系统不修改任何文件实现,不下载第三方文件 - 青石坞 2024校园卡,50G流量套餐开售,可代理。 - 青石坞 macos 下使用 diskutil partitionDisk 失败的问题 因文件名包含不可见符号导致无法转移做种或辅种的解决方案 - 青石坞 shell 实现自释放多文件,自解压功能。 - 青石坞 Mac 下使用 PHPStorm 在开启 GPG 签名提交 Git 时失败的解决方案 Git 入门使用说明 - 青石坞
基于 github 公开的 keys 快速添加到 ssh 的 authorized_keys
2024-01-11 · via 青石坞

逛论坛意外发现 github 居然有一个这样的公开 api,https://github.com/{USER_ID}.keys,里面是这个用户添加的 key 公钥列表。

于是想到自己经常登陆各种新服务器,每次都要复制 key 到服务器上,通过这个可能就简单许多,只需要无脑粘贴命令即可。

当然,是需要先将自己的公钥添加到添加到 Github 的。

(function(){mkdir -p ~/.ssh/; curl -s "https://github.com/${1}.keys" | sed "s/$/ github.com\/${1}/" >> ~/.ssh/authorized_keys} "github_username")

但是这么长的命令记下来也不容易,我就搞了这么一个小脚本,可以更方便的执行。

# 交互式,有确认
bash -c "$(curl -s keys.qs5.org)"

# 无交互,无确认
curl -s keys.qs5.org | sh -s ${github_username}

当然,直接用 curl https://github.com/{USER_ID}.keys >> ~/.ssh/authorized_keys 是一样的效果

Tags: shell, ssh-key, github

上一篇: 因文件名包含不可见符号导致无法转移做种或辅种的解决方案

下一篇: macos 下使用 diskutil partitionDisk 失败的问题