CentOS to modify SSH default 22 port

Source: Internet
Author: User
Tags iptables ssh port

I am a student party, the school's network restrictions on the comparison of strict, this can not be on that can not log on. Windows 3389 is not available and Linux 22 ports are not available.

All will need to modify the port to implement.


First, find a way to connect to your Linux server.
(Mobile hot can OH)

First modify the configuration file


Vi/etc/ssh/sshd_config


Find #port 221, here is the identity default use 22 port, modified to the following:

Port 22
Port 1234

Change it to 1234.
Then save the exit.

Perform

/etc/init.d/sshd restart
This way the SSH port will work concurrently with 22 and 1234.

Edit firewall configuration now: Vi/etc/sysconfig/iptables

Enable Port 1234.
Perform/etc/init.d/iptables restart

Now, use the SSH tool to connect to port 1234 to test for success. If the connection succeeds, edit the Sshd_config settings again and delete the Port22 inside.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.