无法更改 Ubuntu 18.04.1 LTS 上的 ssh 端口

Nis*_*hah 4 ssh openssh

我正在尝试将 ssh 端口从 22 更改为 1111。我已采取以下步骤,但无法做到。

  1. 须藤纳米 /etc/ssh/ssh_config
  2. 删除 # 显示端口 22 的位置
  3. 将端口 22 更改为端口 1111
  4. Ctrl + W -> Y -> Ctrl + O -> 输入 -> Ctrl + X
  5. 须藤 ufw 允许 1111
  6. 须藤 systemctl 重启 ssh
  7. 须藤 systemctl 状态 ssh

输出:

  1. 服务器侦听 0.0.0.0 端口 22
  2. 服务器侦听 :: 端口 22。

ste*_*ver 10

您编辑的文件,/etc/ssh/ssh_config是全球SSH客户端配置文件-更改端口也将改变该端口ssh(和scp)程序试图连接

要更改服务器侦听的端口,则需要修改/etc/ssh/sshd_config

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
Run Code Online (Sandbox Code Playgroud)