How to Change SSH Port Linux Server or VPS

ForumCategory: LinuxHow to Change SSH Port Linux Server or VPS
Kiran asked 3 months ago

Hello guys, today I am going to tell you that how you can easily change the SSH port of your VPS or linux server, changing SSH port of your server is really good to enhance the security of your VPS.

1: First of all go to putty and login to your server via root access login.

2: Now this command on putty,

vi /etc/ssh/sshd_config

3: here you will see written something, just find the "# Port 22" line, and remove the "#" and replace 22 to your port desired port number like 6254 or any other.

4: now save the changes by pressing

:wq!

5: now just fire this command to restart your SSH server.

service sshd restart

Thats it.

now change the port number in putty or winscp when you loggin to your Cpanel.

So guys if you have any question in your mind you can ask me below in the comments.

2 Answers
Ajay answered 3 months ago

Thank you for this great information, but their is another way if you do not want to use putty then you can do it from your filezilla or winscp application also. Just follow the instructions below!

1: Login to your server through filezilla or winscp.

2: now go to etc > ssh folder and here you will see a "sshd_config" file, just right click on it and click on edit.

3: now locate the # port 22 line and remove # and replace 22 to desired number and save the file by pressing ctrl+s.

now restart your server, your SSH port has been changed successfully.

Kiran answered 1 month ago

Thanks you so muchfor this detailed answer.

Your Answer

Accepted file types: txt, jpg, pdf

Add another file