Keeping the default 22 SSH port is really a very bad practice. I have seen many people doesnt bother changing their SSH port even they configure many security features.
In this short and sweet guide Im going to tell you how to change your SSH port to another. This guide applies for Ubuntu/Debian/Centos/Redhat O/S
Attention- Messing with others things on SSH config file is really dangerous and it may lock your server from accessing via SSH. So you will need console access to reset SSH or contact server provider to do this. So forward with your own risk!
Use NANO editor for edit files. If you dont have NANO installed you can install it by
apt-get install nano or yum install nano
1.You need to open SSHD config file using nano.
2.Thats your SSHD config file. On that there will be line called
We need to change that. You can change the number 22 to whatever port that you like. after you done hit Ctrl+O key on keyboard to write the chnages in to the file and then Ctrl+X to exit the text editor.
3. Restart SSH daemon to apply changes in running configuration
on centos run
service sshd restart
On debian or Ubuntu run
Then you will be immediately logged out from current SSH session because port changed.
Its done! Now you can login with your changed port!
Disclaimer- I’m not responsible if you locked your server by changing SSH config file. If you accidentally locked out contact your server company they can fix that for you!
Last 5 posts by Ruchira
- The Role of Social Media and SEO - October 25th, 2013
- Google announces uProxy to overcome internet censorship - October 22nd, 2013
- Command line bandwidth monitors for Linux - October 21st, 2013
- How to install and configure a BitTorrent Sync server - July 9th, 2013
- WordPress comments SEO problems and moved to Disqus - July 5th, 2013