LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   On NFS, non-root users can move/rename files belonging to root. (https://www.linuxquestions.org/questions/linux-server-73/on-nfs-non-root-users-can-move-rename-files-belonging-to-root-597128/)

Stuart Morrow 11-04-2007 05:03 PM

On NFS, non-root users can move/rename files belonging to root.
 
OK, here are the facts:
stuart-server is the NFS server.
stuart-desktop is the NFS client.
The user stuart on both machines has UID 1000 and GID 1000.

And here is the line of stuart-server:/etc/exports referring to the directory I'm having trouble with:
Code:

/home/stuart        stuart-desktop(rw)
Whenever I mount stuart-server:/home/stuart on stuart-desktop, the problem is that any user can mv files belonging to root. This is bad, but it isn't as bad as it could be: luckily, users can't write to files belonging to root.

Here is what I get when I mount stuart-server:/home/stuart on stuart-desktop (parenthetical stuff in bold is my commentary, not the output of the shell!):
Code:

stuart@stuart-desktop:~$ sudo mount stuart-server:/home/stuart /home2/stuart
[sudo] password for stuart:
stuart@stuart-desktop:~$ cd /home2/stuart
stuart@stuart-desktop:/home2/stuart$ ll this.file.belongs.to.root
-rw-r--r-- 1 root root 0 2007-10-31 15:31 this.file.belongs.to.root
stuart@stuart-desktop:/home2/stuart$ mv this.file.belongs.to.root \
> but.`whoami`.can.move.it
stuart@stuart-desktop:/home2/stuart$ ll but*
-rw-r--r-- 1 root root 0 2007-10-31 15:31 but.stuart.can.move.it (bad)
stuart@stuart-desktop:/home2/stuart$ cat > but.stuart.can.move.it #However, I can not write to it
bash: but.stuart.can.move.it: Permission denied (good)
stuart@stuart-desktop:/home2/stuart$

Howcome any old user is allowed to move files that don't belong to him? Naturally, I don't want it to work that way - I want it to work the same as it would if they were local files.

To help me fix this, you may request additional information about these computers if you need to, thank you.

complich8 11-05-2007 12:06 AM

Is stuart the owner of the directory that the file resides in (/home/stuart)? One would expect so...

If you own the directory, you can move (and remove) files in it, even if they're not yours and you can't open them. If you don't (or rather, if you don't have write permission on the directory), you can't. This is somewhat the expected behavior.

Stuart Morrow 11-05-2007 11:12 AM

Ah, so there really isn't anything actually broken? No problem then, and thanks.


All times are GMT -5. The time now is 12:48 AM.