Post4VPS Forum | Free VPS Provider

Full Version: VPS 9 Dallas issues with changing Port Number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been having issues with changing my port number.  With OS CentOS 7 x86_64 Minimal v2 although I think it is more on the VPS side.

These are the steps I followed for changing the port:

yum install nano
/etc/ssh/sshd_config
I removed the #comment before Port 22 and changed the 22 to 6382
Then successfully saved it - ctrl X - Y - Enter
Then tried to restart ssh: service sshd restart

An error came up and it wouldn't allow me to restart the service.  Unfortunately I didn't copy the error wording but it basically said that sshd was unavailable.  Of course when I tried to get in again via SSH there was an error.  I then reinstalled the OS again.  Googled the issue.  Tried alternative commands.  But same results.  Once I've done a change in /etc/ssh/sshd_config I can't get in any longer.  At one point I even tried to change back to #Port 22 - the way it was before. I was still unable to get in again.
It would be the best to see the error you got.

We're talking about CentOS here. The SELinux enforcement is a big thing on CentOS 7 and later. It might be that you need to unlock the port you want to use for SSH to be allowed to be used for SSH / with the SSH server. There was thing thing here multiple times in the past already where people got this messages and simply ignored them... leaving them locked out of their system and wondering what is going on.

Here is the thing I'm talking about but referencing CentOS 8: https://post4vps.com/Thread-How-to-Chang...n-CentOS-8

Without the actual error message we can literally only guess into the blind though.


Edit: Let me know if you want me to look at it.
Thanks for the tip about https://post4vps.com/Thread-How-to-Chang...n-CentOS-8

I'll check this out.