Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh key 的生成和应用 #343

Open
Bpazy opened this issue Dec 14, 2024 · 0 comments
Open

ssh key 的生成和应用 #343

Bpazy opened this issue Dec 14, 2024 · 0 comments

Comments

@Bpazy
Copy link
Owner

Bpazy commented Dec 14, 2024

以我的新机器 pve_gmk_ubuntu 举例,我要在当前机器生成 key,然后复制到目标机器实现免密登录。

先生成 key 并复制到目标机器上:

ssh-keygen -f ~/.ssh/id_rsa_pve_gmk_ubuntu
ssh-copy-id -i ~/.ssh/id_rsa_pve_gmk_ubuntu.pub [email protected]

ssh-keygen -f 可以直接指定路径,就不用试试手动输入,可以直接复制,比较方便。ssh-copy-id 和手动复制过去差不多,省了几秒钟吧。

然后配置 ssh config vim ~/.ssh.config:

Host pve-gmk-ubuntu
    HostName 192.168.31.41
    User ziyuan
    # 如果需要走代理,可以在这里指定
    # ProxyJump 192.168.31.31
    IdentityFile ~/.ssh/id_rsa_pve_gmk_ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant