Skip to content
statance
MenuClose
← All ports

Port 2049: NFS

High risk

Port 2049 is the Network File System. NFSv4 uses only this port; NFSv3 also relies on rpcbind (111) and several dynamic ports. It should not be reachable from the public internet.

Port
2049
Protocol
TCP and UDP
Service
NFS
Expose to internet?
No
Also used by
Linux NFS server, NAS devices, AWS EFS

Is port 2049 safe to open?

NFS trusts the client’s claimed user ID unless Kerberos is in use, so anyone who can mount an export can usually read files as any user except root. Exports to * or broad networks have leaked home directories and backups. It is a LAN protocol and should never be on the internet.

How to secure NFS

  • Export only to specific hosts or subnets in /etc/exports, never *.
  • Keep root_squash (the default) and avoid no_root_squash.
  • Use NFSv4 with Kerberos (sec=krb5p) for untrusted networks.
  • Block 2049 and 111 at the edge.

Check if port 2049 is open

Linux: what is listening on this port

sudo ss -tulpn | grep ':2049 '

Windows (PowerShell): what is listening

Get-NetTCPConnection -LocalPort 2049 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}

From another machine: is it reachable

nc -zv HOST 2049 # or nmap -p 2049 HOST # Windows Test-NetConnection HOST -Port 2049

Test the NFS service itself

showmount -e HOST

Restrict port 2049 in the firewall

Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:2049:2049) instead of relying on the host firewall.

ufw: allow only your private network, deny everyone else

sudo ufw allow from 10.0.0.0/8 to any port 2049 proto tcp sudo ufw deny 2049/tcp

firewalld: allow one source network only

sudo firewall-cmd --permanent --remove-port=2049/tcp sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="2049" protocol="tcp" accept' sudo firewall-cmd --reload

iptables

sudo iptables -A INPUT -p tcp --dport 2049 -s 10.0.0.0/8 -j ACCEPT sudo iptables -A INPUT -p tcp --dport 2049 -j DROP

Windows Firewall (PowerShell, as Administrator)

New-NetFirewallRule -DisplayName "Block 2049 from internet" -Direction Inbound -Protocol TCP -LocalPort 2049 -RemoteAddress Internet -Action Block

Monitor port 2049

Run a TCP port monitor against your public IP on port 2049: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.

Related ports

Port 111rpcbind (portmapper)High risk
Port 445SMBCritical risk
Port 873rsync daemonHigh risk

FAQ

What is port 2049 used for?

Port 2049 is the Network File System. NFSv4 uses only this port; NFSv3 also relies on rpcbind (111) and several dynamic ports. It is also used by Linux NFS server, NAS devices, AWS EFS.

Is it safe to open port 2049?

Not to the public internet. NFS trusts the client’s claimed user ID unless Kerberos is in use, so anyone who can mount an export can usually read files as any user except root. Exports to * or broad networks have leaked home directories and backups. It is a LAN protocol and should never be on the internet.

Is port 2049 TCP or UDP?

NFS uses TCP and UDP on port 2049.

How do I check if port 2049 is open?

On the server, run sudo ss -tulpn | grep ':2049 ' (Linux) or Get-NetTCPConnection -LocalPort 2049 (Windows) to see what is listening. From another machine, run nc -zv HOST 2049 or Test-NetConnection HOST -Port 2049.

All ports →

Know the moment a port stops answering.

TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.