提醒

您正在访问搜索引擎投递页面,强烈建议您:回到主站 查看原文 - ssh登录配置-authorized_keys

memo 编辑 最后修改时间 2023/07/21 15:39

ssh登录配置-authorized_keys

authorized_keys id_rsa.pub ssh秘钥 公钥

生成公钥

$ ssh-keygen  -t rsa -b 2048 ; cat ~/.ssh/id_rsa.pub

创建公钥存放目录

~/.ssh/authorized_keys

// 创建.ssh目录
$ cd ~ ; mkdir .ssh
$ chmod go= .ssh

// 创建公钥存放文件
$ cd ~/.ssh ; touch authorized_keys
$ chmod u=rw,go=r authorized_keys

设置公钥

把生成的公钥追加写入要登录主机的 authorized_keys

$ cat 'ssh-rsa AAAAB3...== rsa 2048-020421' >> ~/.ssh/authorized_keys

更改现有私钥的密码而无需重新生成密钥对

$ ssh-keygen -p -f ~/.ssh/id_ed25519
Enter old passphrase: [Type old passphrase]
Key has comment 'your_email@example.com'
Enter new passphrase (empty for no passphrase): [Type new passphrase]
Enter same passphrase again: [Repeat the new passphrase]
Your identification has been saved with the new passphrase.

另外补充一个远程控制sh

GitHub地址 https://github.com/sxin0/so

2 条评论
未登录用户
支持 Markdown 语法
@sxin0
sxin0发表于将近 2 年前

six six six

@acane77
acane77发表于超过 1 年前

打卡