centos change ssh port

in this tutorial, How to change ssh port another with selinux. The default ssh port 22, when you change port another with rules selinux (SELINUX=enforcing) get error can't change ssh port. Solve problem!( Running command following with root account)
File selinux with content SELINUX=enforcing as below:
[huupv@huupv ~]$ sudo cat /etc/sysconfig/selinux
[sudo] password for huupv:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.

How do it...
Step 1: Open sshd_config file
# vi /etc/ssh/sshd_config
Add port 2222 as below:
Port 2222
Step 2: Enable port 2222 with rule selinux.
# sudo semanage port -a -t ssh_port_t -p tcp 2222
Step 3: restart ssh services
#systemctl restart sshd


Post a Comment

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6