Modify the SSH Port (Port) of CentOS)

Source: Internet
Author: User
Tags ssh port
CentOS is really troublesome to modify the SSH Port (Port) CentOS, or because there are too many security considerations and too many context issues need to be considered. Similar problems have been encountered in samba before, just like SSH. List the key modification steps, and study the context tag later (your own translation has not been taken into consideration...
CentOS is really "troublesome" to modify the SSH Port (Port) CentOS, or because there are too many security concerns and too many context problems need to be considered. Similar problems have been encountered in samba before, just like SSH. List the key modification steps and study the context tag (your own translation, but you have not read the relevant Chinese tutorials. This article summarizes gino's efforts to adjust the lab work records for its own SSH. References: CentOS modify SSH default port http://www.2cto.com/ OS /201208/145084.html

/RHEL 6: semanage SELinux Command Not Found http://www.cyberciti.biz/faq/redhat-install-semanage-selinux-command-rpm//RHEL 6: Change OpenSSH Port To 1255 (SELinux Config) http://www.cyberciti.biz/faq/centos-redhat-enterprise-linux6-change-sshd-port-number/
Linux Server: CentOS 6.2 www.2cto.com desktop environment: Windows 7 connection tool: putty 1. modify the SSH configuration file vi/etc/ssh/sshd_config and disable root logon, add restrict user Port 2345 PermitRootLogin noAllowUsers gino2. modify iptablesvi/etc/sysconfig/iptables copy 22 Port ACCEPT rule-a input-m state -- state NEW-m tcp-p tcp -- dport 2345- j ACCEPT3. modify port contexts (key ), you need to modify the context semanage port-a-t ssh_port_t-p tcp 23454. restart the SSH service/etc/init. d/sshd restart It is migrated to Port 2345 and only accessible to gino users, improving security. Www.2cto.com Appendix: semanage 1. install semanage. by default, CentOS does not have this command, you need to check who provided this command for yum provides/usr/sbin/semanage and then install yum-y install policycoreutils-python2.semanage for prot context, for example, to check the ssh port status, semanage port-l | grep ssh should be able to get the following results: ssh_port_t tcp 2345, 22 can also use netstat to verify netstat-tulpn | grep 2345 so far, after the SSH adjustment is complete, the contexts mechanism is not very good and requires further research. Author Ginoz
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.