EzDevInfo.com

port interview questions

Top port frequently asked interview questions

Is there an equivalent to ssh-copy-id for Windows?

Is there any equivalent or port of ssh-copy-id available for Windows? That is, is there an easy way to transfer SSH keys from a local machine to a remote server under Windows?

In case it helps, I'm using Pageant and Kitty (a Putty alternative) already.


Source: (StackOverflow)

What is the maximum port number?

I'd like to set some linux services to non-standard ports - what's the highest valid port number?


Source: (StackOverflow)

Advertisements

How should I select the port number for a new tool?

I'm creating an internal collaboration tool that will use a central server (on an intranet) and one or more ports for socket communication to clients. I know that many ports are reserved for particular purposes and others are conventionally used for certain types of traffic.

How should I go about picking a default port that is least likely to have been "claimed" by someone else for their tool? Is there a database that identifies all known (even unconventional) port usage?


Source: (StackOverflow)

How to check if a port is open for remote system(ubuntu) [closed]

Is it possible to check that if the ports are open for the remote system on ubuntu server?

I should able to check if a port(eg:ssh) on my machine is open for the remote machine.


Source: (StackOverflow)

How do you free up a port being held open by dead process?

A colleague of mine recently ran into a problem where a process that had supposedly died was still bound to a network port, preventing other processes from binding to that port. Specifically, netstat -a -b was reporting that a process named System with PID 4476 had port 60001 open, except no process with PID 4476 existed, at least as far as I could tell.

Process Explorer and Task Manager did not list PID 4476 (though there was another process named System with PID 4, which had its own set of TCP connections that did not include 60001). taskkill /PID 4476 also reported that PID 4476 could not be found.

Is there a way to kill this mysterious System process to free up the port to which it's currently bound? What can cause this to happen? How can there be processes that none of Task Manager, Process Explorer, and taskkill don't know about? Rebooting managed to fix the problem, but I'd like to know if there's a way to fix this without rebooting.


Source: (StackOverflow)

How to check what port mysql is running on

On my windows dev box mysql is running on port 3306

How can I check what port it is running on the unix server that I have to upload the app to.


Source: (StackOverflow)

How can I find out if a port is opened or not?

I have installed Apache server on my Windows 7 computer. I was able to display the default index.php by typing http://localhost/ in the address line of my browser.

However, I am still unable to see this page by typing IP address of my computer (neither locally (from the same computer) no globally (from another computer connected to the Internet)).

I was told that I need to open port 80. I did it (in a way described here) but it did not solve the problem.

First of all I would like to check which ports are opened and which are not. For example I am not sure that my port 80 was closed before I tried to open. I am also not sure that it is opened after I tried to open it.

I tried to run a very simple web server written in Python. For that I used port 81 and it worked! And I did not try to open the port 81. So, it was opened by default. So, if 81 is opened by default, why 80 is not? Or it is?

ADDITIONAL INFORMATION:
1. In my httpd.conf file I have "Listen 80".
2. This site tells me that port 80 on my computer is opened.
3. I get different responses if I try http://myip:80 and http://myip:81. In the last case browser (Chrome) writes me that link is broken. In the first case I get: Forbidden You don't have permission to access / on this server.
4. IE writes that "The website declined to show this webpage".


Source: (StackOverflow)

Declaring multiple ports for the same VirtualHosts

Declare multiple ports for the same VirtualHosts:

SSLStrictSNIVHostCheck off
# Apache setup which will listen for and accept SSL connections on port 443.
Listen 443
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:443

<VirtualHost *:443>
  ServerName domain.localhost
  DocumentRoot "/Users/<my_user_name>/Sites/domain/public"
  <Directory "/Users/<my_user_name>/Sites/domain/public">
    Order allow,deny
    Allow from all
  </Directory>

  # SSL Configuration
  SSLEngine on
  ...
</VirtualHost>

How can I declare a new port ('listen', ServerName, ...) for 'domain.localhost'?

If I add the following code, apache works (too much) also for all other subdomain of 'domain.localhost' (subdomain1.domain.localhost, subdomain2.domain.localhost, ...):

<VirtualHost *:80>
  ServerName pjtmain.localhost:80
  DocumentRoot "/Users/Toto85/Sites/pjtmain/public"
  RackEnv development
  <Directory "/Users/Toto85/Sites/pjtmain/public">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Source: (StackOverflow)

Disable TeamViewer from "stealing" Port 80?

How can you disable TeamViewer from using/reserving port 80? I am certain in the previous version <v4.1.6 there used to be a radio button option in "options" which disabled it from needing it, but now I cannot find it.

Is port 80 serisouly required by this remote desktop app? It is conflicting with IIS on our development server and becoming a real pain.

Thanks all.


Source: (StackOverflow)

How do I specify port number for PuTTY to use with Windows cmd?

I start most of my SSH connections with a windows command like this

cmd://"C:\Program Files\PuTTY\putty.exe" -ssh root@xxx.xx.xxx.xx

I assume this defaults to port 22. Now I need to connect on a different port. I tried

cmd://"C:\Program Files\PuTTY\putty.exe" -ssh root@xxx.xx.xxx.xx:xxx

(port number on the end) but it won't allow the connection. I know the port number and IP are correct because if I fire up PuTTY and start a session with these details I can get in fine.

p.s. If this is the wrong stackexchange for this question please don't destroy me, I did look for quite a long time before deciding to post here.


Source: (StackOverflow)

Understanding Ports: How do multiple browser tabs communicate at the same time? [closed]

I realized today that I fundamentally don't understand how port communication works.

If I fire up an instance of a webserver listening on port 80, it can respond to many requests from many different browser tabs, all communicating over port 80.

However, I cannot start up two instances of the server, both listening on port 80, as it results in a port conflict.

I've always taken this as a given, (only one process can bind to a specific port at any given time) without ever really thinking it through -- aren't there multiple processes communicating on port 80? (ie., each of the tabs running in the browser?)


Source: (StackOverflow)

nginx: no permission to bind port 8090 but it binds to 80 and 8080

I'm struggling with some strange permission related behavior: when I configure nginx to listen to port 8080 everything works as expected, but when I use any other port I get something like

2014/01/10 09:20:02 [emerg] 30181#0: bind() to 0.0.0.0:8090 failed (13: Permission denied)

in /var/log/nginx/error.log

I have no clue where to look at so I don't really know what parts of the configuration might be interesting.

in nginx.conf nginx is configured to run as nginx:

user  nginx;

Also user nginx is in another group 'git'

in the site-config I tried to listen like this:

server {
    listen 8090; #does not work
    #listen 8080; #works
    #listen 9090; #does not work
    #listen 9090 default; #does not work neighter
    #listen 80; #works!
    server_name <some IP>;
    ...
}

I have only one more listener which serves port 443.

When I start some other service e.g. a SimpleHTTPServer on port 8090 etc. as non-root everything works fine:

$ python -m SimpleHTTPServer 8090
Serving HTTP on 0.0.0.0 port 8090 ...
localhost.localdomain - - [10/Jan/2014 09:34:19] "GET / HTTP/1.1" 200 -

What can the reasons be for denied permissions in general?

System is Fedora 18 ngnix is stock fedora 1.2.9


Source: (StackOverflow)

netstat shows a listening port with no pid but lsof does not

This question is similar to Network port open, but no process attached?

I've tried everything from there, reviewed the logs, etc... and can't find anything.

My netstat shows a TCP listening port and a UDP port without a pid. When I search lsof for those ports nothing comes up.

netstat -lntup
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:44231           0.0.0.0:*               LISTEN      -               
udp        0      0 0.0.0.0:55234           0.0.0.0:*                           - 

The following commands display nothing:

lsof | grep 44231
lsof | greo 55234
fuser -n tcp 44231
fuser -n udp 55234

After rebooting, those "same" two connections are there except with new port numbers:

netstat -lntup
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:45082           0.0.0.0:*               LISTEN      -               
udp        0      0 0.0.0.0:37398           0.0.0.0:*                           - 

And once again, the lsof and fuser commands show nothing.

Any ideas what they are? Should I be concerned about them?


Source: (StackOverflow)

How to allow non-root user to listen on privileged port?

I want syslog to run as a non-root user on my linux box. That makes it impossible for it to bind to port 514 - because that's a privileged port. Is there any way I can grant non-admin user "foo" the ability to listen on port 514?


Source: (StackOverflow)

How to find the number of open ports in linux?

How to find the number of open ports in linux? I want to see if I am running out of ports. Also, how do I see the limit of my OS?


Source: (StackOverflow)