跳转至

ssh

  • ssh密钥
    # -t key 类型
    # -C 注释
    ssh-keygen -t ed25519 -C "注释"
    
  • ssh代理

    # ~/.ssh/config
    Host github.com
        Hostname ssh.github.com
        Port 22
        User git
        ProxyCommand nc -X connect -x 127.0.0.1:10809 %h %p
    

  • ssh指定端口

    Host aaa.bbb
        HostName aaa.bbb
        Port 6000
        User git
        IdentityFile ~/.ssh/id_rsa
    

  • 配置ssh登录

    # su vi /etc/ssh/sshd_config
    # 禁止root登录
    PermitRootLogin no
    
    # 禁止密码登录
    PasswordAuthentication no
    
    # 允许密钥登录
    PubkeyAuthentication yes
    

  • 通过ssh远程登录

    # ~/.ssh/authorized_keys
    # 将公钥写入authorized_keys中
    vi ~/.ssh/authorized_keys