{"id":1362,"date":"2015-03-25T15:47:29","date_gmt":"2015-03-25T12:47:29","guid":{"rendered":"http:\/\/www.fatihacar.com\/blog\/?p=1362"},"modified":"2015-10-28T11:50:05","modified_gmt":"2015-10-28T08:50:05","slug":"how-to-change-ssh-port-when-selinux-is-enable-on-oracle-linux-7","status":"publish","type":"post","link":"http:\/\/www.fatihacar.com\/blog\/how-to-change-ssh-port-when-selinux-is-enable-on-oracle-linux-7\/","title":{"rendered":"How to Change SSH Port When Selinux is Enable on Oracle Linux 7"},"content":{"rendered":"<p>SSH service runs on 22 port number. You can change this port number for security. If you use Oracle Linux 7, Centos 7 or Red Hat Linux 7 versions, you can change port number with below operations. If selinux is enabled, you have to add new port number to selinux configuration because of the fact that selinux allows only 22 port number for ssh connections.<\/p>\n<p><strong>Step 1 : Change Port Number<\/strong><\/p>\n<blockquote><p>\n[root #] vi \/etc\/ssh\/sshd_config<br \/>\nPort 2290<\/p>\n<p>Save and Exit\n<\/p><\/blockquote>\n<p><strong>Step 2 : Change Selinux Configuration<\/strong><\/p>\n<blockquote><p>\nTo change:<br \/>\n[root #] semanage port -a -t ssh_port_t -p tcp 2290<br \/>\nTo list:<br \/>\n[root #] semanage port -l | grep ssh\n<\/p><\/blockquote>\n<p><strong>Step 3 : Add New Port to Firewall<\/strong><\/p>\n<blockquote><p>\nTo Add:<br \/>\n[root #] firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-port=2290\/tcp<br \/>\nTo Activate<br \/>\n[root #] firewall-cmd &#8211;reload\n<\/p><\/blockquote>\n<p><strong>Step 4 : Restart SSHD Service to Activate New SSH Confiuration<\/strong><\/p>\n<blockquote><p>\n[root #] systemctl restart sshd.service\n<\/p><\/blockquote>\n<p><strong>Step 5 : Show Running SSH Port<\/strong><\/p>\n<blockquote><p>\n[root #] ss -tnlp | grep ssh\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>SSH service runs on 22 port number. You can change this port number for security. If you use Oracle Linux 7, Centos 7 or Red Hat Linux 7 versions, you can change port number with below operations. If selinux is enabled, you have to add new port number to selinux configuration because of the fact&#8230;<\/p>\n","protected":false},"author":37,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[18,95],"tags":[],"class_list":["post-1362","post","type-post","status-publish","format-standard","hentry","category-linux-unix","category-system-security"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p39NFI-lY","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/1362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/comments?post=1362"}],"version-history":[{"count":5,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/1362\/revisions"}],"predecessor-version":[{"id":1425,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/1362\/revisions\/1425"}],"wp:attachment":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/media?parent=1362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/categories?post=1362"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/tags?post=1362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}