Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: File permissions using NFS

  1. #1
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    470

    Default File permissions using NFS

    I have a server running NFS server, using ext4 on all drives. In the /home directory is a directory called common. I would like all files saved in this directory, including additional directories, to have the group attributes set to RWX upon being saved, not after the fact. I would like this to happen without having to change the umask (which is currently 0022) for each computer (which are all running ext4). According to my understanding of the man page, setting the s attribute on the directory should do this. However, I can't seem to get it to work. Can someone please explain how to do this?

    Bart

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    9,164
    Blog Entries
    3

    Default Re: File permissions using NFS

    I'm not sure which man page you are looking at.

    The "umask" is a per user (or per-process) property. Normally, NFS file permissions are the same as for a local file system, except that root might be wrapped to "nobody" (depending on the share options).

    The "s" group permission on a directory forces all created files and subdirectories to default to the same group. It doesn't affect the "rwx" permission bits. It affects the group (i.e. which named group to use).
    opensuse Leap 42.3; KDE Plasma 5;
    opensuse tumbleweed; KDE Plasma 5 (test system);

  3. #3
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    470

    Default Re: File permissions using NFS

    So the s flag is not what I want.

    Is there a way to set rwx attributes based on directory?

    Or, how can I make any files in a directory have rwx attributes without changing umask on the originating computer?

    Bart

  4. #4
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    470

    Default Re: File permissions using NFS

    Quote Originally Posted by nrickert View Post

    The "umask" is a per user (or per-process) property. Normally, NFS file permissions are the same as for a local file system, except that root might be wrapped to "nobody" (depending on the share options).
    Is saving a file to a NFS drive a process? If so, how to set the umask for that property? What if I don't want "Normally"? How to set file permissions for just NFS?

    Bart

  5. #5
    Join Date
    Nov 2009
    Location
    West Virginia Sector 9
    Posts
    14,589

    Default Re: File permissions using NFS

    Attributes are copied with the files. No directory flag will change the attributes. The flags only deal with attributes on newly created files in a directory. In any case attribute change can only be done by the owner or root. So I guess it would be a good idea to say exactly how these files are being copied and by who.

  6. #6
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    470

    Default Re: File permissions using NFS

    A example of what I want to be able to do is to create a LibreOffice document on my machine, save it to the server. and have my wife modify it and replace it. Perhaps I'll do more modifications, perhaps her even more. In other words, I would like any file saved to the common directory on the server to be able to be modified by anyone who can access the server.

    Bart
    Last edited by montana_suse_user; 03-Dec-2017 at 15:53. Reason: stupid smell clacker

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    9,164
    Blog Entries
    3

    Default Re: File permissions using NFS

    Quote Originally Posted by montana_suse_user View Post
    How to set file permissions for just NFS?
    I don't think it is actually possible.

    For what you are wanting to do, your best bet might be to use a Windows file system (FAT or NTFS). In that case, the permissions are set by the mount options. Unless you will be having really large files (4G or larger), I would suggest FAT.
    opensuse Leap 42.3; KDE Plasma 5;
    opensuse tumbleweed; KDE Plasma 5 (test system);

  8. #8
    Join Date
    Dec 2008
    Location
    Montana, USA
    Posts
    470

    Default Re: File permissions using NFS

    I don't think I like that answer!

    Guess I'm just going to have to teach my wife how to change permissions on files she wants me to help her with! Now, that should be fun!

    You know she's going to remind me how we could do that when we had a Windows server!

    Bart

  9. #9

    Default Re: File permissions using NFS

    I have not seen anybody mention FACLs (filesystem ACLs) yet, which makes
    me wonder if maybe those will not work via NFS, but otherwise I think they
    are the solution. The setfacl command lets you set permissions on things
    that exist now, or "default" permission (ACLs) on things that will exist
    in the future within a directory, so that sounds ideal. Assuming
    /path/to/directory is the location, and 'users' is the group you want to
    have rwx rights (why 'x'?) on files, these commands should both modify
    everything currently as well as make it work going forward with new
    files/directories:

    Code:
    #sets default ACL on existing files/directories recursively
    setfacl -R -d -m g:users:rwx /path/to/directory
    
    #sets ACL on existing files/directories recursively
    setfacl -R -m g:users:rwx /path/to/directory
    Once done, the 'users' group members should have rwx on everything within
    /path/to/directory and anything new should get those too.

    FACLs are a bit weird, and sometimes thought to be fairly complex, but
    once you understand the basics I think they are simple enough, and
    infinitely flexible. The simplicity of user-owner, group-owner, and
    other-users is extended nicely, though the simplicity of only those three
    sources of rights/permissions is lost by adding that additional
    flexibility, so maybe that's part of the reason for the stigma.

    --
    Good luck.

    If you find this post helpful and are logged into the web interface,
    show your appreciation and click on the star below.

    If you want to send me a private message, please let me know in the
    forum as I do not use the web interface often.

  10. #10
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    9,164
    Blog Entries
    3

    Default Re: File permissions using NFS

    Quote Originally Posted by montana_suse_user View Post
    Guess I'm just going to have to teach my wife how to change permissions on files she wants me to help her with! Now, that should be fun!
    Have her set her umask to 002 instead of 022. It can be set in ".profile" in her home directory.

    If this is a home computer, there isn't much risk. Even more so, if only files on the NFS mounted file system are shared.

    The only problem is that a few programs are very fussy about group-writable. The main ones are "ssh" and "gpg", which insist that the home directory and their config directories (".ssh" and ".gnupg") not be group writable.
    opensuse Leap 42.3; KDE Plasma 5;
    opensuse tumbleweed; KDE Plasma 5 (test system);

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •