2

I'm trying to mount a NFS folder in WSL2 Ubuntu 20.04

sudo mount singularity:/srv/Storage /mnt/storage -v

But it gives me an error

mount.nfs: access denied by server while mounting singularity:/srv/Storage

I checked the /etc/exports on the server, and sure enough, I have

/srv/Storage  *(rw,sync,no_subtree_check,no_root_squash,crossmnt)

(I set it to * from the previous 10.0.0.0/16 for debugging)

And just to be sure, ran exportfs -ra and sudo service nfs-kernel-server restart.

Yet even still, when I try to mount in WSL, I get the permission denied error. I can mount on other machines just fine.

3
  • 1
    Taking the risk of stating the obvious, but: /srv/Skipspace != /srv/Storage ...
    – tink
    Commented May 2, 2022 at 21:33
  • @tink yea that's just at typo. Changed the names to something easier to understand at a glance
    – cclloyd
    Commented May 2, 2022 at 23:18
  • @cclloyd did you ever figure this out? I'm having the same issue
    – Kayson
    Commented Jul 18, 2022 at 23:46

1 Answer 1

2

I have the same issue, but have a few possible solutions.

My nfs logs look like this (I'm guessing yours do, too):

cat /var/log/syslog:

refused mount request from 192.168.123.123 for /mnt/poolio/data
(/mnt/data): illegal port 59646

The solutions seem to be rabbit holes...

By default, WSL's network is NAT'd. This requires port forwarding.

Basically what's going on:

  1. The NFS client is using a reserved port under 1024 which can only be open with root privileges, hence the security.

  2. WSL does the port translation (NAT) -> client port is now greater than 1024.

  3. The NFS server refuses the connection with that insecure port.

There are several possible solutions, each of which have their pros and cons unfortunately:

  • Solution 1: Use port forwarding

  • Solution 2: Use Bridge Mode instead of NAT on WSL interface. (apparently creates DNS issues)

  • Solution 3: Allow insecure ports on the NFS server. Problem is anyone can impersonate you if you allow this.

The first two solutions are mentioned in this Stack Overflow answer. The third I don't have a link for yet -- My apologies.

I have not had a chance to try any of these yet, myself. I'd be interested in hearing your results if you get a chance to try them before I do.

Apologies for not providing more complete instructions. I know that is how I prefer my answers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .