Skip to content

Instantly share code, notes, and snippets.

@iaoedsz2008
Created August 5, 2020 07:09
Show Gist options
  • Save iaoedsz2008/71e095a22344fc701cc972428b919f09 to your computer and use it in GitHub Desktop.
Save iaoedsz2008/71e095a22344fc701cc972428b919f09 to your computer and use it in GitHub Desktop.

[TOC]

ssh 套件使用说明

ssh

ssh 客户端工具

文件 /etc/ssh/ssh_config

此文件为当前系统中的ssh全局配置

  • 常用配置选项

    • ServerAliveInterval 可防止长时间无操作导致的掉线问题
    ServerAliveInterval 10
    
    • Host、IdentityFile 配置连接对应主机时使用的证书文件
    Host 192.168.1.123
      IdentityFile ~/.ssh/github
    

文件 ~/.ssh/config

此文件为当前用户的ssh配置 配置内容与 /etc/ssh/ssh_config 一致

sshd

ssh 服务

文件 /etc/ssh/sshd_config

文件 ~/.ssh/authorized_keys

ssh-keygen

生成密钥对

ssh-keygen -t rsa -b 4096 -f ~/.ssh/key1

ssh-copy-id

将公钥拷贝至指定主机

ssh-copy-id -i ~/.ssh/key1.pub user@host

ssh-import-id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment