I have a php server running on port 4444 on my Ubuntu 15.04 machine. Now when I execute telnet 4444 it works fine. Now I have connected my machine and a windows 7 machine using mobile hotspot. I got my ip address using ifconfig which shows

wlan0     Link encap:Ethernet  HWaddr b4:b6:76:b2:18:b7  
      inet addr:  Bcast:  Mask:
      inet6 addr: fe80::b6b6:76ff:feb2:18b7/64 Scope:Link
      RX packets:23468 errors:0 dropped:0 overruns:0 frame:0
      TX packets:21537 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:15077925 (15.0 MB)  TX bytes:3582649 (3.5 MB)

Now when I execute telnet 4444 on my windows machine i get Could not open connection to the host, on port 4444: Connect Failed. nmap -sU -p 4444 shows the following

Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-22 23:03 IST
Nmap scan report for localhost (
Host is up (0.00015s latency).
4444/udp closed krb524

And netstat -tulpn shows the following

Proto Recv-Q Send-Q Local Address           Foreign Address       State       PID/Program name
tcp        0      0  *               LISTEN      -               
tcp        0      0 *               LISTEN      -               
tcp        0      0*               LISTEN      1611/php        
tcp6       0      0 :::80                   :::*                    LISTEN      -               
tcp6       0      0 :::21                   :::*                    LISTEN      -               
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
udp        0      0  *                           -               
udp        0      0    *                           -               
udp        0      0 *                           -               
udp        0      0   *                           -               
udp        0      0  *                           1744/chromium-brows
udp        0      0  *                           -               
udp        0      0 *                           -               
udp6       0      0 :::56100                :::*                                -               
udp6       0      0 :::25246                :::*                                -               
udp6       0      0 :::5353                 :::*                                -               

How can I fix this? Please help. Thanks in advance


It is not recommended to use telnet, but instead to use SSH. The reason for this, is that telnet communications are unencrypted, and vulnerable to eavesdropping.

You can make your PHP server allow remote connections via SSH by installing openssh-server:

sudo apt-get install openssh-server

If you still want to use telnet, then according to your output, it would appear that port 4444 is not open on you Linux box. Assuming you've not setup a firewall on that computer, it would appear that your server is not running the telnet server. To install that service:

sudo apt-get install telnetd

I hope this helps.

  • I installed telnet and ssh. Still when i try to telnet into port 4444 it says the same failed message. However when I ssh into port 22 it logs in perfectly and gives me root access to ubuntu terminal. can I ssh into port 4444. if yes then how?
    – Makarov
    Dec 23 '15 at 9:38
  • You can ssh into port 4444, if you change /etc/ssh/sshd_config on the server. Why does the server need to listen on port 4444? Dec 23 '15 at 14:42
  • Because I wrote the program to listen on port 4444. What else can i do?
    – Makarov
    Dec 24 '15 at 6:22
  • If you only need the program to run upon remote login, you could rewrite your program to listen to port 22. Otherwise, what is the benefit of having the program listen to port 4444? Dec 24 '15 at 17:53

In your netstat output, the line

tcp 0 0* LISTEN 1611/php

Indicates that php (process id 1611) is listening on TCP port 4444 on the internal address That's on the loop-back interface, and can only be reached from the local host, your Ubuntu machine, not from the Windows box.

In contrast, e.g., your chromium-brows... (PID 1744) listens on, which is special, meaning "all interfaces" (so it should be reachable from the outside, e.g., the Windows machine).

Your nmap UDP probe reports the port "closed" because php uses the TCP protocol.

I find lsof useful for investigating what's listening, but . To get some output on my machine, I'll ask for port 22 (SSH) instead of 4444:

$ sudo lsof -P -i :22 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME sshd 2152 root 5u IPv4 10192 0t0 TCP *:22 (LISTEN) sshd 2152 root 6u IPv6 10194 0t0 TCP *:22 (LISTEN)

You see it listens on "*" (all interfaces). As in your case, a UDP scan won't find it open:

$ sudo nmap -sU -p 22 Starting Nmap 6.40 ( http://nmap.org ) at 2015-12-22 13:53 EST Nmap scan report for localhost ( Host is up (0.000048s latency). PORT STATE SERVICE 22/udp closed ssh
Nmap done: 1 IP address (1 host up) scanned in 0.37 seconds

So much for the explanation of what you saw. To fix, you should instruct your PHP server to listen on or * instead of or "localhost". I don't know that program; if you cannot change its configuration, you could always use ssh or iptables to forward the port.


  • I have added rules to the iptable to allow incoming connection on port 4444 using sudo iptables -A INPUT -p tcp --dport 4444 -j ACCEPT and also sudo iptables -A INPUT -p udp --dport 4444 -j ACCEPT just to be sure.
    – Makarov
    Dec 23 '15 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.