Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 4840
Next
In Process

askthedev.com Latest Questions

Asked: September 25, 20242024-09-25T00:08:41+05:30 2024-09-25T00:08:41+05:30In: Ubuntu

How can I enable specific ports on my Ubuntu system?

anonymous user

I’m really hoping someone can help me out here. So, I’ve been trying to figure out how to enable specific ports on my Ubuntu system. I’ve got this project I’m working on that requires some services to communicate with each other, but I keep hitting a wall because certain ports are just not playing nice.

I’ve done a bit of digging online, but honestly, a lot of the instructions I found were either too technical or just didn’t seem to apply to my version of Ubuntu, which is 20.04 LTS. I’m not completely clueless when it comes to command line stuff, but I wouldn’t say I’m a pro either. It’s kind of frustrating!

From what I gather, it seems like I need to dive into some firewall settings, and I think it’s UFW (Uncomplicated Firewall) that Ubuntu uses by default. But here’s where it gets tricky for me. I want to make sure that I’m only opening the ports I need without leaving my system vulnerable. Like, how do I know which ones are safe to open? For instance, I really need to enable ports 8080 and 5432 for my web app and database, but I’m a little scared that I might accidentally open more than I need and compromise my system’s security.

Also, if I open these ports, will they stay open after a reboot? I’ve heard that some changes might not stick unless you do something specific, and I really don’t want to have to reset everything every time my computer restarts.

If someone could walk me through the steps to do this or even just point me towards a good guide that’s not too complicated, I’d honestly appreciate it so much. I’m sure there are a lot of other people who struggle with this too, and it’d be great to have a resource that’s straightforward. Thanks in advance for any help you can give!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2024-09-25T00:08:41+05:30Added an answer on September 25, 2024 at 12:08 am

      It sounds like you’re on the right track with UFW (Uncomplicated Firewall). It’s a great tool for managing your firewall settings easily.

      Here’s how to enable specific ports:

      1. Check UFW status: First, let’s see if UFW is enabled. Open your terminal and type:

        sudo ufw status

        If it’s inactive, you can enable it with:

        sudo ufw enable
      2. Allow specific ports: To open the ports you need (8080 and 5432), run the following commands:

        sudo ufw allow 8080
        sudo ufw allow 5432
      3. Verify the changes: After that, you can double-check that the ports are open:

        sudo ufw status

        You should see both ports listed as allowed.

      About security:

      Opening these specific ports should be safe as long as you know what services are using them. Just ensure that the applications communicating on these ports are trustworthy.

      Persistence after reboot:

      The good news is that UFW rules persist after reboot. Once you’ve set it up, the rules will stick unless you change them.

      Need more help?

      For more detailed instructions, you could check out the official Ubuntu firewall documentation, but the steps above should cover your needs! Don’t hesitate to reach out if you have more questions.

      Best of luck with your project!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2024-09-25T00:08:42+05:30Added an answer on September 25, 2024 at 12:08 am



      Enabling Ports on Ubuntu 20.04 LTS

      To enable specific ports on your Ubuntu 20.04 LTS system, you will indeed want to utilize the Uncomplicated Firewall (UFW). First, ensure UFW is installed and enabled. You can do this by running the following commands in your terminal:

      sudo apt update
      sudo apt install ufw
      sudo ufw enable
      

      Once UFW is enabled, you can open the specific ports you need while keeping your system secure. For your web app and database, you can open ports 8080 and 5432 by executing:

      sudo ufw allow 8080/tcp
      sudo ufw allow 5432/tcp
      

      These commands will allow traffic through the specified ports. To ensure that your changes persist after a reboot, UFW automatically saves the rules you set. You can check the status of UFW and verify that your rules are active using:

      sudo ufw status
      

      This command will display the currently active rules, confirming that your ports remain open post-reboot. It’s always good practice to review which ports are essential for your project and only open those, minimizing any security risks.


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this issue?
    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?
    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. Has anyone experienced this issue ...
    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?
    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else encountered this problem, and what ...

    Sidebar

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this ...

    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?

    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. ...

    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?

    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else ...

    • How can I configure a server running Ubuntu to bind specific IP addresses to two different network interfaces? I'm looking for guidance on how to ...

    • Is it possible to configure automatic login on Ubuntu MATE 24.04?

    • After upgrading from Ubuntu Studio 22.04 to 24.04.1, I lost all audio functionality. What steps can I take to diagnose and resolve this issue?

    • I am experiencing issues booting Ubuntu 22.04 LTS from a live USB. Despite following the usual procedures, the system fails to start. What steps can ...

    • I'm encountering a problem with my Expandrive key while trying to update my Ubuntu system. Has anyone else faced similar issues, and if so, what ...

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.