Welcome to the Linux Foundation Forum!

Opening ports in ubuntu


Does anybody know of any commands that will open ports in ubuntu?


  • mfillpot
    mfillpot Posts: 2,177
    There really isn't a command to just open a port, you must have a service attached to the port with an understanding of how to handle the received data.

    What exactly are you trying to do?
  • saqman2060
    I am trying to setuo ssh on my home workgroup of 6 PCs, 3 are running ubuntu 10.10, 1 Fedora 14(server) and 2 XP pro systems with sp3.

    I want the ability to remote to all systems, securely and administer them other than using VNC. I never bothered with ssh. Yet since I'm mastering network security, ssh seemed to be a good start.

    The ubuntu systems have ssh installed by default and tested the ssh program on my computer. I ssh to my IP address using my gnome shell console, and the console said " ssh: connect to host x.x.x.x port 22: Connection refused"? I thought that meant, port 22 was closed. I don't know of any commands to test that port directly. I used the "network tools" supplied by my system. Used netstat to get a listing of network services running and the ports associated with them. Did not see port 22, did see port 2222. I even scanned my system looking to have it print out ports that were open using the "port scan" tool. No port 22 available, however, did see port 2222 with an unknown service.

    Now, I don't know if port 22 and port 2222 are the same. I configured the sshd_config file and changed the defualt port number from 22 to 2222. Ssh to my IP, and was able to login. The reason I used port 2222, is because I was researching how to setup openssh, which is used on linux servers, and I came across suggestion to change the default port 22 to 2222.

    I figured that had to be some kind of command to either test of open specific ports. I guess my question has been answered. With the linux text material I have, it mention of sort.
  • Goineasy9
    Goineasy9 Posts: 1,114
    Make sure the firewall is set on the Fedora server to allow port 22 or port 2222. Are you using SELinux? If so make sure that isn't blocking access (it usually warns you though and most folks have SELinux disabled). I guess I would also look at the firewall and AppArmour in Ubuntu. Check hidden .ssh config files in /home, make sure there aren't old security keys present. In Fedora there is "Services" under the Administration menu, I'm sure there's something similar in Ubuntu. My quess from the error is that it's a firewall problem.
  • saqman2060
    That is a good thought. I thought you would have to set the firewall manually. I will look into it.



Upcoming Training