Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I change Fedora 25 SSH port?

Steps already tried:

1) In /etc/ssh/ssh_config I have uncommented the line consisting of # Port 22 and change 22 to a a random one, e.g.: 50687. Additionally I uncommented the # Host * line.

2) I tried creating a new line consisting of:

Port 50687

at the bottom of the file.

3) /etc/ssh/ssh_config has the note:

# To modify the system-wide ssh configuration, create a  *.conf  file under
#  /etc/ssh/ssh_config.d/  which will be automatically included below
Include /etc/ssh/ssh_config.d/*.conf

The only file in .../ssh_config.d/ is 05-redhat.conf

Again I tried uncommenting (and modifying) the # Host 22* line and creating a new line at the bottom of the.

4) I created a file 06-myfile.conf conisisting only of either:

Port 50687

or

Host *
Port 50687

After completing any of these steps I have issued:

sudo systemctl restart sshd.service

and tried to connect (via port 50687) and/or:

sudo systemctl status sshd.service
[sudo] password for spaceman: 
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-04-25 14:47:15 BST; 23min ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 5967 (sshd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/sshd.service
           └─5967 /usr/sbin/sshd -D

Apr 25 14:47:15 nas systemd[1]: Starting OpenSSH server daemon...
Apr 25 14:47:15 nas sshd[5967]: Server listening on 0.0.0.0 port 22.
Apr 25 14:47:15 nas sshd[5967]: Server listening on :: port 22.
Apr 25 14:47:15 nas systemd[1]: Started OpenSSH server daemon.

What utterly n00bish error am I making?