修改端口

  1. 修改sshd配置

    1
    vim /etc/ssh/sshd_config
  2. 编辑添加新的端口,默认Port=22

    1
    Port=8888
  3. 重启sshd

    1
    service sshd restart

关闭密码登录

  1. 修改sshd配置

    1
    vim /etc/ssh/sshd_config
  2. 找到PasswordAuthentication,修改yesno

    1
    PasswordAuthentication no
  3. 重启sshd

    1
    service sshd restart