码上灵感
  • 经验

    • 服务器

      • 操作系统
      • 网络配置
      • ssh配置
      • 压力测试
      • IPMI
    • 基础工具

      • xshell
      • xftp
    • 基础环境

      • anaconda
      • v2ray
      • cuda
      • docker
      • nginx
      • ufw
      • git lfs 大文件
    • ubuntu

      • virtualbox
    • minio

      • 安装
    • postgres

      • 安装
    • AI相关折腾

      • maxkb
      • huggingface
      • vllm
      • ktransformers
      • wan2.1
    • 疑难杂症

      • ubuntu自动更新
      • xshell隧道转发失败
      • video自动播放不成功的问题
      • 3d模型快速生成

ssh配置

生成密钥对

ssh-keygen -t rsa -b 4096

它会提示你选择存储位置,默认是

~/.ssh/id_rsa  (私钥)
~/.ssh/id_rsa.pub  (公钥)

追加公钥到本地

~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

首先查看/etc/ssh/sshd_config.d目录下有没有配置文件,有的话使用这个目录下的, 没有的话使用/etc/ssh目录下的sshd_config 禁用密码登录,禁用root账户ssh

PasswordAuthentication no
PermitRootLogin no

开启防火墙

sudo ufw allow 22/tcp  # 允许 SSH
sudo ufw enable        # 启用防火墙
sudo ufw status        # 查看状态

重启ssh服务

sudo systemctl restart ssh
Prev
网络配置
Next
压力测试