Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Yesterday I tried to use this heroku command:

heroku run db:migrate

and after a long wait it said that it was in timeout

After many tries I've googled about this and I found that, since also other commands have given the same response, the problem was that my pc (or my net?) hasn't the port 5000 open.

Can i open this? How in Ubuntu?

If it is releated to my providere I read somewhere that probably I can whitelist this port: can i do this from Ubuntu? How?

share|improve this question
    
All ports > 1024 can be bound without any special permission by default in Ubuntu. Maybe you want it to be accessible from the Internet and you are under a router? If this is the case, then you need to play with your router's configuration (look for port mapping, which should be the quickest solution) –  Andrea Corbellini Feb 28 '12 at 16:16
    
"All ports > 1024 can be bound without any special permission by default in Ubuntu." how? –  Matteo Pagliazzi Feb 28 '12 at 16:18
    
and about router configuration do you know where can i found it? –  Matteo Pagliazzi Feb 28 '12 at 16:18
    
Router Configuration page. If your ip is 192.168.1.x, then probably 192.168.1.1. Look for 'Port Forwarding'. You'll need name and password. If you haven't set it, google will help you find defaults, or look on bottom if isp provided router. –  jedijf Feb 28 '12 at 17:45
    
it seems that my router isn't configurable.... –  Matteo Pagliazzi Feb 28 '12 at 18:18
show 2 more comments

1 Answer

You open a port with a program. The operating system provides primitives for you to do so, which is usually done at the OS level is to allow the port to accept connections. For this, you may need to configure the firewall or even SELinux, depending on your installation (even though I did not see Ubuntu standard installation bringing any of these). @ Andrea pointed out that you do not need special permission to the program if it wants to open the port. Again, this is a program, a server, which will be listening on a port. Any network communication, using connection-oriented protocol (such as TCP / IP), needs a listening server port, and connecting client. I do not know Heroku, but I guess by the looks of the command that you posted, you are trying to migrate a database from one place to another. That depends if you open two connections, one to extract the data from and the other one to write into. If you intend to receive connections from the Internet, then you need a port on a public IP, which arrives to the port 5000 of your server machine. If you think you have a correct installation, then try this command:

sudo netstat -tnlp 

It should give you something like this output:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      940/sshd   

This is the case, for a SSH server, listening on port 22. You should have something similar, for the 5000 port. It that's the case, then try connecting from your internal network to the server's IP, and then figure out how to open it to Internet. You can do this with the telnet command:

$ telnet 192.168.1.1 22
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.8p1 Debian-7ubuntu1
^\
Connection closed by foreign host.

If you got the word "Connected" then your port is alive and kicking :) This is a sample for a SSH server listening, your heroku output should be different.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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