Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the ssh default remote port number in Linux 6

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, Xiaobian will bring you about how to modify the ssh default remote port number in Linux 6. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.

Operation steps:

1. Modify the ssh_config configuration file

vim /etc/ssh/sshd_config

2. Find the line #Port 22 in the configuration file (default port 22)

3. Modify this line to the port number you want.

Port 222 (note: remove the #in front)

4.[Optional] If you want to add a port number coexisting (port 22 and port 222 are effective at the same time)

Port 22 (note: no #in front)

Port 222 (note: no #in front)

5. After keeping exiting, restart the sshd service

/etc/init.d/sshd restart

If you have a firewall set up, you need to add new port rules

6. Edit iptables file

vim /etc/sysconfig/iptables

7. Add port 222 rule

-A INPUT -m state -state NEW -m tcp -p tcp -dport 222 -j ACCEPT

8. Restart iptables service after saving and exiting

service iptables restart

9. Test connection, call it a day.

Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

The above is how to modify the ssh default remote port number in Linux 6. If there is a similar doubt, please refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report