I vimed into


I edited

#Port 22


#Port 922

After I restarted httpd.

service httpd restart

However, ssh still only works on -p22.

How do I edit the ssh config file to change the ssh port?


Remove the comment marker (#) before the statement.

Port 922

and you have to restart sshd, not httpd.

sudo systemctl restart sshd
  • Thanks. How do I restart ssh. I was restarting httpd asuming that would cascade into ssh. – seamus Jun 27 '18 at 6:54
  • [root@fedora-e1 ~]# service ssh restart Redirecting to /bin/systemctl restart ssh.service Failed to restart ssh.service: Unit ssh.service not found. – seamus Jun 27 '18 at 6:54
  • Why should this cascade from httpd to ssh? Try ˋsshdˋ or check with ˋsystemctl | grep sshˋ to find the correct name. – Sven Jun 27 '18 at 7:22

Had to edit the /etc/ssh/sshd_config file, but also had to:

semanage port -a -t ssh_port_t -p tcp 922

In order to get semanage

dnf install policycoreutils-python-utils

Then restart sshd

systemctl reload sshd.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.