OpenBSD、ssh、sshd、WSL从安装ssh到使用

羊舌子瑜
2023-12-01
  • ssh

    From WikiPedia,Secure Shell(SSH) is a cryptographic network protocol for operating netwaork services securely over an unsecured network.

    SSH provides a secure channel over an unsecured network by using a client-server architecture, connecting an SSH client application with an SSH server.

    Windows 10 uses OpenSSH as its default SSH client.

    SSH is designed as a replacement for Telnet and for unsecured remote shell protocols such as the Berkeley rlogin, rsh, and rexec protocols.

  • OpenSSH

    From WikiPedia, OpenSSH(Also known as OpenBSD Secure Shell) is a suite of secure networking utilities based on the Secure Shell(SSH) protocol.

    OpenSSH started as a fork of the free SSH program developed by Tatu Ylonen.

    OpenSSH was first released in 1999, and is currently developed as part of the OpenBSD operating system.

  • 启动ssh服务

    sudo service ssh start

  • sshd

    The client is ssh, the daemon is sshd.

    sshd is the OpenSSH server process. It listens to incoming connections using the SSH protocol and acts as the server for the protocol.

    It handles user authentication, encryption, terminal connections, file transfers, and tunneling.

    service sshd start # 启动服务端
    ps axjf # 查看进程树
    

    详情参见《sshd-ssg.com

  • sshd: no hostkeys available – exiting

    启动出错,参见链接

    sudo ssh-keygen -A
    
  • ssh: Could not resolve hostname data: Name or service not known

    修改/etc/hosts文件,将data所在ip地址写入hosts文件:127.0.0.1 data,如此ssh就能认识data

    如果修改hosts文件出现read only,用sudo

  • connection closed by ip:port

    ssh需要同时安装client和server。

    sudo apt-get update
    sudo apt-get install openssh-server
    sudo service ssh start
    ps -e | grep ssh 
    # 如果只看到sshd
    eval ssh-agent
    /etc/init.d/ssh restart
    
  • Agent admitted failure to sign using the key

    ssh-add ~/.ssh/id_rsa
    
  • 从零开始全过程

    sudo apt-get update
    sudo apt-get install openssh-server
    sudo service ssh start
    ps -e | grep ssh 
    # 如果只看到sshd
    eval ssh-agent
    /etc/init.d/ssh restart
    # 修改配置文件
    vim /etc/hosts  # 添加指定ip hostname
    
  • Could not open a connection to your authentication agent.

    eval `ssh-agent -s`
    ssh-add /path/id_rsa
    
  • Permissions 0777 for ‘/mnt/c/Users/name/.ssh/id_rsa’ are too open.

    chmod 600 /home/xiaoqiang.he/.ssh/*

 类似资料: