{"id":17854,"date":"2024-11-27T12:37:10","date_gmt":"2024-11-27T12:37:10","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=17854"},"modified":"2024-11-27T12:37:11","modified_gmt":"2024-11-27T12:37:11","password":"","slug":"how-to-open-ports-on-ubuntu","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/","title":{"rendered":"How To Open Ports On Ubuntu"},"content":{"rendered":"\n<p>Opening specific ports on your Ubuntu server is essential for allowing communication through services like HTTP, HTTPS, SSH, and FTP. <\/p>\n\n\n\n<p>Properly configuring open ports ensures network services respond correctly while maintaining security. However, exposing ports unnecessarily can pose security risks. To minimize vulnerabilities, only open the ports you need and implement robust security practices, such as strong passwords and regular system monitoring.<\/p>\n\n\n\n<p>Ubuntu uses&nbsp;<strong>UFW (Uncomplicated Firewall)<\/strong>, a user-friendly command-line utility that simplifies firewall management. UFW allows you to define rules for filtering incoming and outgoing traffic, making it an effective tool for securing your server while maintaining accessibility for essential services.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to Open Ports Using UFW<\/strong><\/h3>\n\n\n\n<p>Follow these steps to open ports on Ubuntu using UFW:<\/p>\n\n\n\n<p><strong>Check UFW Status<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure UFW is active and check its current status:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw status<\/code><\/code><\/pre>\n\n\n\n<p><strong>Allow Specific Traffic<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>HTTP (Port 80)<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw allow http<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>HTTPS (Port 443)<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw allow https<\/code><\/code><\/pre>\n\n\n\n<p><strong>Specify Port and Protocol:<\/strong>For example, to allow incoming TCP traffic on port 8080:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw allow 8080\/tcp <\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Allow incoming UDP traffic on port 53:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw allow 53\/udp<\/code><\/code><\/pre>\n\n\n\n<p><strong>Enable UFW<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Apply the changes by enabling UFW<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw enable<\/code><\/code><\/pre>\n\n\n\n<p><strong>Verify Rules<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Confirm the port is open by checking UFW\u2019s status again.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw status<\/code><\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>How to Close Ports Using UFW<\/strong><\/h3>\n\n\n\n<p>To deny access to a previously opened port, use the&nbsp;<code>deny<\/code>&nbsp;command. For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Close HTTP traffic:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw deny http<\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Close HTTPS traffic:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><code>sudo ufw deny https<\/code><\/code><\/pre>\n\n\n\n<p>Replace&nbsp;<code>http<\/code>,&nbsp;<code>https<\/code>, or port numbers with the appropriate service or port you wish to close.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Best Practices for Opening Ports<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Open Only Necessary Ports:<\/strong>\u00a0Minimize exposure by enabling only essential services.<\/li>\n\n\n\n<li><strong>Secure Your System:<\/strong>\u00a0Use strong passwords, update software regularly, and monitor for suspicious activity.<\/li>\n\n\n\n<li><strong>Test Changes:<\/strong>\u00a0Verify port configurations after each adjustment to ensure functionality and security.<\/li>\n<\/ul>\n\n\n\n<p>By carefully managing open ports and adhering to security best practices, you can maintain a secure and efficient Ubuntu server environment.<\/p>\n\n\n\n<p><strong>That will be all!<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-a-basic-firewall-with-uncomplicated-firewall-ufw\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Configure a Firewall Using UFW on Ubuntu<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Opening specific ports on your Ubuntu server is essential for allowing communication through services like HTTP, HTTPS, SSH, and FTP. Properly configuring open ports ensures network services respond correctly while maintaining security. However, exposing ports unnecessarily can pose security risks. To minimize vulnerabilities, only open the ports you need and implement robust security practices, such [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1820,1824,1835,1879,2128],"doc_tag":[],"class_list":["post-17854","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-security","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-06","word_count":334,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Eugene","author_nicename":"eugene","author_url":"https:\/\/truehost.com\/support\/author\/eugene\/"},"doc_category_info":[{"term_name":"Cloud servers in Kenya","term_url":"https:\/\/truehost.com\/support\/docs-category\/cloud-servers-in-kenya\/"},{"term_name":"dedicated servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/dedicated-servers\/"},{"term_name":"Security","term_url":"https:\/\/truehost.com\/support\/docs-category\/security\/"},{"term_name":"Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/servers\/"},{"term_name":"VPS-Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/vps-servers\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Open Ports On Ubuntu -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Open Ports On Ubuntu -\" \/>\n<meta property=\"og:description\" content=\"Opening specific ports on your Ubuntu server is essential for allowing communication through services like HTTP, HTTPS, SSH, and FTP. Properly configuring open ports ensures network services respond correctly while maintaining security. However, exposing ports unnecessarily can pose security risks. To minimize vulnerabilities, only open the ports you need and implement robust security practices, such [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-27T12:37:11+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-open-ports-on-ubuntu\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-open-ports-on-ubuntu\\\/\",\"name\":\"How To Open Ports On Ubuntu -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#website\"},\"datePublished\":\"2024-11-27T12:37:10+00:00\",\"dateModified\":\"2024-11-27T12:37:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-open-ports-on-ubuntu\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-open-ports-on-ubuntu\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-open-ports-on-ubuntu\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Open Ports On Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Open Ports On Ubuntu -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/","og_locale":"en_US","og_type":"article","og_title":"How To Open Ports On Ubuntu -","og_description":"Opening specific ports on your Ubuntu server is essential for allowing communication through services like HTTP, HTTPS, SSH, and FTP. Properly configuring open ports ensures network services respond correctly while maintaining security. However, exposing ports unnecessarily can pose security risks. To minimize vulnerabilities, only open the ports you need and implement robust security practices, such [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/","article_modified_time":"2024-11-27T12:37:11+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/","name":"How To Open Ports On Ubuntu -","isPartOf":{"@id":"https:\/\/www.truehost.com\/support\/#website"},"datePublished":"2024-11-27T12:37:10+00:00","dateModified":"2024-11-27T12:37:11+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-open-ports-on-ubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How To Open Ports On Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/www.truehost.com\/support\/#website","url":"https:\/\/www.truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/www.truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/www.truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/www.truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=17854"}],"version-history":[{"count":1,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17854\/revisions"}],"predecessor-version":[{"id":17855,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/17854\/revisions\/17855"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=17854"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=17854"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=17854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}