更新时间:2025-09-10 GMT+08:00
分享

配置远程登录

  1. 执行以下命令更新apt服务。

    sudo apt update #更新服务

  2. 安装SSH服务并修改配置。

    sudo apt update install openssh-server #安装ssh服务
    sed -i '/^PermitRootLogin/d' /etc/ssh/sshd_config
    sed -i '/^PasswordAuthentication/d' /etc/ssh/sshd_config
    sed -i '/^UseDNS/d' /etc/ssh/sshd_config
    sed -i '/^ChallengeResponseAuthentication/d' /etc/ssh/sshd_config
    sh -c 'echo "PermitRootLogin yes" >>/etc/ssh/sshd_config'
    sh -c 'echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config'
    sh -c 'echo "UseDNS no" >>/etc/ssh/sshd_config'
    sh -c 'echo "ChallengeResponseAuthentication no" >>/etc/ssh/sshd_config'
    

  3. 重启服务生效。

    systemctl restart sshd  #重启服务生效

相关文档