1
root@photon-machine [ /mnt/data/torrents ]# touch aa
touch: cannot touch 'aa': Permission denied
root@photon-machine [ /mnt/data/torrents ]# ls -al
total 131
drwxrwxr-x  5 1000 nasgroup  5 Aug 26 21:03 .
drwxrwxr-x 23 1000 nasgroup 26 Aug 26 22:51 ..
drwxrwxr-x 12 1000 nasgroup 13 Aug 27 14:11 complete
drwxrwxr-x  2 1000 nasgroup  2 Aug 27 14:11 incomplete
drwxrwxr-x  2 1000 nasgroup  9 Aug 27 11:11 torrents_watched_folder
root@photon-machine [ /mnt/data/torrents ]# id
uid=0(root) gid=0(root) groups=0(root),1000(nasgroup)

According to the above I should be able to create a file in that directory.

What am I missing?

Does it matter that the /mnt/data is a nfs (version 3) mount from a TrueNas box?

the line in /etc/fstab is the following:

192.168.1.50:/mnt/NasPool/main/Transmission   /mnt/data   nfs   defaults   0   0

To answer the questions: @user10489: in /etc/exports the line looks like:

/mnt/NasPool/main/Transmission -alldirs -quiet

If I touch a file in a 777 permissions directory, I get

-rw-r----- 1 nobody nasgroup 0 Aug 27 16:09 aa

@telometto: if I do a ls -l on my dirs from the TrueNas box I get:

drwxrwxr-x   2 acasa  acasa   9 Aug 27 11:11 torrents_watched_folder

and the same permissions for the other 2 folders. if I issue id acasa, I get the following:

uid=1000(acasa) gid=1000(acasa) groups=1000(acasa)
3
  • What does the export line from the NAS look like? is rootsquash enabled or disabled? If you have a directory with permissions 0777 and touch a file in it, who owns the file?
    – user10489
    Aug 27, 2022 at 13:01
  • If you SSH into your NAS, what's the output of ls -l of the torrents dir and its subdirs (who's the owner and group)?
    – telometto
    Aug 27, 2022 at 13:06
  • I edited the post because of limited formatting options in comments. Aug 27, 2022 at 13:27

1 Answer 1

1

The NFS protocol, to reduce security issues, "squashes" the root userid to the user nobody unless the no_root_squash option is used. (Default is root_squash.)

The solution here is either to enable this option (dangerous! If you do, at least restrict it by host.) or stop using root to access this NFS share and switch to a regular user.

(Note: some versions of NFS may spell this option differently.)

2
  • I would like to say that for the TrueNasCore (at least) modifying directly the /etc/exports file is not a good option, as the file gets overwritten each time the machine boots. For persistence of settings across reboots is better to use the web interface to change settings. Aug 27, 2022 at 14:19
  • I wouldn't change the option anyway. It's best to just not use root to access NFS.
    – user10489
    Aug 27, 2022 at 16:14

You must log in to answer this question.

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