Cannot change ssh port

I changed the port in /etc/ssh/sshd_config to 1234 from the default 22: (not really 1234, just example)

#Port 22
Port 1234

I restarted the computer and no luck, still on port 22. Worked fine on my two Debian machines, but none of the Arch ones. Any ideas?

Are you sure you changed that file? If so, try changing /etc/ssh/sshd_config per the Arch WIKI. Not trying to be cheeky.


The file is actually /etc/ssh/sshd_config.
(You probably meant that one. Works fine here though :man_shrugging: )

Maybe something else in the config is messed up or you have another line with “Port” in it somewhere?
Could you post the content of your config file?

1 Like

What does this command show?

journalctl -u sshd

working just fine here
and you don’t need to restart the computer
just restart ssh

sudo systemctl restart sshd
1 Like


is the file only to make sure :wink: not conf
And in addition, it could be you need to change the port on the firewall settings also…

Ah, mistyped. Good catch.

Bingo. That was it. Port 22 was specified in the bottom of the file. Looks like something Arch or Endeavour does in the stock config. Thanks.

Nope they do not

1 Like

Just to clarify, there are two ssh config files.

  1. /etc/ssh/ssh_config sets the client ssh port and other options for the client computer. this ssh port is which port the client TRANSMITS a query to the remote computer (usually a server)

  2. /etc/ssh/sshd_config set the server (RECEIVING computer) ssh port to “listen” on for a request from the client. The extra d in sshD_config refers to a daemon which runs in the background to listen for incoming requests.

So it depends on what you are trying to do as to which config file to edit.

If you want to use different ports for different computers (servers) you may want to request from, here is an example;
Github’s ssh port is 22 (recieving) and I can’t change that.
My LAN server / NAS has it’s receiving ssh port set to 9876 (not really, just an example)

Port 22
Host *
Port 9876

I believe that the * could also be the host name of my server.

So when I push something to github, it’s on port 22
When I send a request to my local server, it’s on port 9876
Of course my local server is listening on port 9876



This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.