26

I want to know on the windows operating system, what is the port number for the file sharing service?

For example as you know the port number for HTTP service is 80. So I need to know the port number of file sharing protocol?

Chaminda Bandara
  • 529
  • 6
  • 20
  • What file sharing service? Are you referring to SMB? First identify the protocol, then see this chart: http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers – MaQleod Jun 06 '14 at 20:23
  • 3
    Official article that might be of interest: [Port Assignments for Commonly-Used Services](http://technet.microsoft.com/en-us/library/cc959833.aspx) – and31415 Jun 06 '14 at 22:24

2 Answers2

28

I've seen all of these..file sharing related

UDP-137, UDP-138, TCP-139,TCP-445

And possibly TCP port 135, though that may be something to do with something called "RPC" (source (archived)).

on an windows 7 machine all of those are listening. Some are related to NETBIOS so you can do start...\\compname

This site adds:

If the server has NBT enabled, it listens on UDP ports 137, 138, and on TCP ports 139, 445. If it has NBT disabled, it listens on TCP port 445 only.

And this site (archived) mentions:

"In Windows 2000/XP/2003, Microsoft added the possibility to run SMB directly over TCP/IP, without the extra layer of NetBT. For this they use TCP port 445. "

So in 2K,XP,2003...and I suppose Win 7,8, it is possible to run file sharing on only port 445 But you'd be doing start...\\ip rather than start..\\compname

ruffin
  • 1,825
  • 1
  • 14
  • 17
barlop
  • 23,380
  • 43
  • 145
  • 225
  • 1
    @MaQleod http://en.wikipedia.org/wiki/Server_Message_Block SMB protocol, that page mentions those ports I listed.. and about authentication. – barlop Jun 06 '14 at 20:28
  • It covers some of the possibilities, but not all. Windows is capable of NFS, SMB, FTP, SSH/SCP and many other file sharing protocols and authentication for these services can require more than just AD, such as LDAP or NIS. SMB/AD/Krb certainly is the most common use case, but OP never really clarified. – MaQleod Jun 08 '14 at 00:52
  • 3
    @MaQleod The term "file sharing" is pretty well known to users of windows, and doesn't mean FTP or SSH. It's an option in Windows called "File Sharing". There are a multitude of expressions associated with it, such as turn file sharing on, or enable file sharing or make sure the firewall is allowing file sharing through. Maybe SMB is an even more technical term, but "windows file sharing" or "file sharing in windows", is specific assuming they are using their terminology correctly. It doesn't look like Win7 has a built in SSH server. – barlop Jun 08 '14 at 01:50
  • 1
    @MaQleod He wasn't asking about every protocol, even non-native, that windows can possibly run, that allows sharing of files. and "file sharing" is what windows calls SMB. I'm not even sure whether/where windows calls "file sharing" SMB though indeed it is SMB. But 'file sharing' is thus a very correct term for it. – barlop Jun 08 '14 at 01:51
  • Just open TCP-445 first and see if that works. Don't open others until you know you need them. I add this mainly for my own benefit, because I refer back to this answer from time to time, and only now have I found that at least for the requirements I've faced, the answer is as simple as one little port. – R.D. Alkire Sep 21 '21 at 21:12
  • 1
    @R.D.Alkire yes, see my last paragraph about only 445, And yes you can of course as you suggest, apply that to when you are configuring (that word you didn't mention but meant in that comment of yours),, a firewall. – barlop Sep 21 '21 at 22:23
0

If file transfer is via FTP - TCP/21, in case of SFTP - TCP/22

User M
  • 111
  • 2