Welcome to the Linux Foundation Forum!

Opening Ports

Does anybody know of any commands that will open ports in a linux system?

Comments

  • woboyle
    woboyle Posts: 501
    You mean as in expose them to outside systems who want to connect to services running on your computer? Unless you are running SELinux extensions or a software firewall of some sort, then your ports are already open. So, please describe your system configuration, network configuration, and EXACTLY what it is that you are trying to accomplish. Needless to say, this can be a deep/wide subject...
  • 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.
  • saqman2060 ,

    Applications open up ports for your system not commands. You can try #netstat -apn it will show you what particular program is running on what ports.


    If you encounter "connection refused' that means either the apps is not running or the port you tried is not the port defined by your application.
  • Thanks Edward, that was helpful.
  • mfillpot
    mfillpot Posts: 2,177
    Please remember that netstat and nmap (when scanning the localhost) are not actually reouting to the outside for the tests so in most cases they work behind your firewall and do not reflect the publicly visible ports. To test exactly what is publicly visible on your system it is best to run "nmap -sS -O {chosen IP}" on a remote system to see what is available.
  • This was handy. My system should that 4 ports were open including port 2222 and 996 were closed.

Categories

Upcoming Training