05-09-2021, 03:24 PM
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.
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.