Permissions on a mounted NFS share

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am trying to make a php script on a webserver write into a folder /data on a fileserver.



Apache 2.2, PhP 5.x. It's just a test configuration but I'd like to understand the thing somehow as I am not very experienced regarding permissions when it comes to webservers.



I am sharing the folder /data on the fileserver by adding



/data 192.168.20.6(rw,sync,no_subtree_check) 


Mount the folder by



sudo mount 192.168.20.5:/data /mnt/data


Create a link to the webroot(does that makes sense at all?)



sudo ln -s /mnt/data /webroot/site1/share


Then I get this:



Warning: fopen(/webroot/site1/share/data/uploads/Fotoraum/Original/Bluehend/test.txt): failed to open stream: Permission denied 


Where and how do I have to adjust permissions in a sane manner to allow the script to write into /data and its subfolders?



Thanks a lot!










share|improve this question























  • I suppose the warning is from a webserver? They typically run under a separate user, e.g. www. You mounted using sudo, hence the mountpoint is owned by root. Please post the output of ls -ld /mnt/data and su <www-user>; touch /webroot/site1/share/foo.txt
    – Sebastian
    Sep 9 '14 at 21:26











  • btw, using a mounted nfs volume might not be a very good idea: (a) if the fileserver is offline, the webservice stops working (b) network/server latency. Perhaps it's better store the files locally and then sync them over regularily?
    – Sebastian
    Sep 9 '14 at 21:30











  • make sure that user that is creating a link has ownership of data folder.
    – Raza
    Sep 9 '14 at 21:59










  • mammal here :) @sebastian drwxr-xr-x 14 nobody nogroup 4096 Sep 9 22:36 /mnt/data
    – mammal
    Sep 11 '14 at 18:32











  • @sebastian Doing the ls -ld on the link gives me this lrwxrwxrwx 1 root root 9 Sep 11 21:54 data -> /mnt/data btw the files that we put on the nfs are just the huge original files of the pictures we store. Smaller resized versions are on local storage ;) To behonest, I don't know who the www-user is...
    – mammal
    Sep 11 '14 at 20:00














up vote
1
down vote

favorite












I am trying to make a php script on a webserver write into a folder /data on a fileserver.



Apache 2.2, PhP 5.x. It's just a test configuration but I'd like to understand the thing somehow as I am not very experienced regarding permissions when it comes to webservers.



I am sharing the folder /data on the fileserver by adding



/data 192.168.20.6(rw,sync,no_subtree_check) 


Mount the folder by



sudo mount 192.168.20.5:/data /mnt/data


Create a link to the webroot(does that makes sense at all?)



sudo ln -s /mnt/data /webroot/site1/share


Then I get this:



Warning: fopen(/webroot/site1/share/data/uploads/Fotoraum/Original/Bluehend/test.txt): failed to open stream: Permission denied 


Where and how do I have to adjust permissions in a sane manner to allow the script to write into /data and its subfolders?



Thanks a lot!










share|improve this question























  • I suppose the warning is from a webserver? They typically run under a separate user, e.g. www. You mounted using sudo, hence the mountpoint is owned by root. Please post the output of ls -ld /mnt/data and su <www-user>; touch /webroot/site1/share/foo.txt
    – Sebastian
    Sep 9 '14 at 21:26











  • btw, using a mounted nfs volume might not be a very good idea: (a) if the fileserver is offline, the webservice stops working (b) network/server latency. Perhaps it's better store the files locally and then sync them over regularily?
    – Sebastian
    Sep 9 '14 at 21:30











  • make sure that user that is creating a link has ownership of data folder.
    – Raza
    Sep 9 '14 at 21:59










  • mammal here :) @sebastian drwxr-xr-x 14 nobody nogroup 4096 Sep 9 22:36 /mnt/data
    – mammal
    Sep 11 '14 at 18:32











  • @sebastian Doing the ls -ld on the link gives me this lrwxrwxrwx 1 root root 9 Sep 11 21:54 data -> /mnt/data btw the files that we put on the nfs are just the huge original files of the pictures we store. Smaller resized versions are on local storage ;) To behonest, I don't know who the www-user is...
    – mammal
    Sep 11 '14 at 20:00












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am trying to make a php script on a webserver write into a folder /data on a fileserver.



Apache 2.2, PhP 5.x. It's just a test configuration but I'd like to understand the thing somehow as I am not very experienced regarding permissions when it comes to webservers.



I am sharing the folder /data on the fileserver by adding



/data 192.168.20.6(rw,sync,no_subtree_check) 


Mount the folder by



sudo mount 192.168.20.5:/data /mnt/data


Create a link to the webroot(does that makes sense at all?)



sudo ln -s /mnt/data /webroot/site1/share


Then I get this:



Warning: fopen(/webroot/site1/share/data/uploads/Fotoraum/Original/Bluehend/test.txt): failed to open stream: Permission denied 


Where and how do I have to adjust permissions in a sane manner to allow the script to write into /data and its subfolders?



Thanks a lot!










share|improve this question















I am trying to make a php script on a webserver write into a folder /data on a fileserver.



Apache 2.2, PhP 5.x. It's just a test configuration but I'd like to understand the thing somehow as I am not very experienced regarding permissions when it comes to webservers.



I am sharing the folder /data on the fileserver by adding



/data 192.168.20.6(rw,sync,no_subtree_check) 


Mount the folder by



sudo mount 192.168.20.5:/data /mnt/data


Create a link to the webroot(does that makes sense at all?)



sudo ln -s /mnt/data /webroot/site1/share


Then I get this:



Warning: fopen(/webroot/site1/share/data/uploads/Fotoraum/Original/Bluehend/test.txt): failed to open stream: Permission denied 


Where and how do I have to adjust permissions in a sane manner to allow the script to write into /data and its subfolders?



Thanks a lot!







php nfs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 10 '14 at 0:55









Ramesh

22.3k3199178




22.3k3199178










asked Sep 9 '14 at 21:20









mammal

612




612











  • I suppose the warning is from a webserver? They typically run under a separate user, e.g. www. You mounted using sudo, hence the mountpoint is owned by root. Please post the output of ls -ld /mnt/data and su <www-user>; touch /webroot/site1/share/foo.txt
    – Sebastian
    Sep 9 '14 at 21:26











  • btw, using a mounted nfs volume might not be a very good idea: (a) if the fileserver is offline, the webservice stops working (b) network/server latency. Perhaps it's better store the files locally and then sync them over regularily?
    – Sebastian
    Sep 9 '14 at 21:30











  • make sure that user that is creating a link has ownership of data folder.
    – Raza
    Sep 9 '14 at 21:59










  • mammal here :) @sebastian drwxr-xr-x 14 nobody nogroup 4096 Sep 9 22:36 /mnt/data
    – mammal
    Sep 11 '14 at 18:32











  • @sebastian Doing the ls -ld on the link gives me this lrwxrwxrwx 1 root root 9 Sep 11 21:54 data -> /mnt/data btw the files that we put on the nfs are just the huge original files of the pictures we store. Smaller resized versions are on local storage ;) To behonest, I don't know who the www-user is...
    – mammal
    Sep 11 '14 at 20:00
















  • I suppose the warning is from a webserver? They typically run under a separate user, e.g. www. You mounted using sudo, hence the mountpoint is owned by root. Please post the output of ls -ld /mnt/data and su <www-user>; touch /webroot/site1/share/foo.txt
    – Sebastian
    Sep 9 '14 at 21:26











  • btw, using a mounted nfs volume might not be a very good idea: (a) if the fileserver is offline, the webservice stops working (b) network/server latency. Perhaps it's better store the files locally and then sync them over regularily?
    – Sebastian
    Sep 9 '14 at 21:30











  • make sure that user that is creating a link has ownership of data folder.
    – Raza
    Sep 9 '14 at 21:59










  • mammal here :) @sebastian drwxr-xr-x 14 nobody nogroup 4096 Sep 9 22:36 /mnt/data
    – mammal
    Sep 11 '14 at 18:32











  • @sebastian Doing the ls -ld on the link gives me this lrwxrwxrwx 1 root root 9 Sep 11 21:54 data -> /mnt/data btw the files that we put on the nfs are just the huge original files of the pictures we store. Smaller resized versions are on local storage ;) To behonest, I don't know who the www-user is...
    – mammal
    Sep 11 '14 at 20:00















I suppose the warning is from a webserver? They typically run under a separate user, e.g. www. You mounted using sudo, hence the mountpoint is owned by root. Please post the output of ls -ld /mnt/data and su <www-user>; touch /webroot/site1/share/foo.txt
– Sebastian
Sep 9 '14 at 21:26





I suppose the warning is from a webserver? They typically run under a separate user, e.g. www. You mounted using sudo, hence the mountpoint is owned by root. Please post the output of ls -ld /mnt/data and su <www-user>; touch /webroot/site1/share/foo.txt
– Sebastian
Sep 9 '14 at 21:26













btw, using a mounted nfs volume might not be a very good idea: (a) if the fileserver is offline, the webservice stops working (b) network/server latency. Perhaps it's better store the files locally and then sync them over regularily?
– Sebastian
Sep 9 '14 at 21:30





btw, using a mounted nfs volume might not be a very good idea: (a) if the fileserver is offline, the webservice stops working (b) network/server latency. Perhaps it's better store the files locally and then sync them over regularily?
– Sebastian
Sep 9 '14 at 21:30













make sure that user that is creating a link has ownership of data folder.
– Raza
Sep 9 '14 at 21:59




make sure that user that is creating a link has ownership of data folder.
– Raza
Sep 9 '14 at 21:59












mammal here :) @sebastian drwxr-xr-x 14 nobody nogroup 4096 Sep 9 22:36 /mnt/data
– mammal
Sep 11 '14 at 18:32





mammal here :) @sebastian drwxr-xr-x 14 nobody nogroup 4096 Sep 9 22:36 /mnt/data
– mammal
Sep 11 '14 at 18:32













@sebastian Doing the ls -ld on the link gives me this lrwxrwxrwx 1 root root 9 Sep 11 21:54 data -> /mnt/data btw the files that we put on the nfs are just the huge original files of the pictures we store. Smaller resized versions are on local storage ;) To behonest, I don't know who the www-user is...
– mammal
Sep 11 '14 at 20:00




@sebastian Doing the ls -ld on the link gives me this lrwxrwxrwx 1 root root 9 Sep 11 21:54 data -> /mnt/data btw the files that we put on the nfs are just the huge original files of the pictures we store. Smaller resized versions are on local storage ;) To behonest, I don't know who the www-user is...
– mammal
Sep 11 '14 at 20:00










2 Answers
2






active

oldest

votes

















up vote
0
down vote













per your comment I think the following option is better than chmod -R 775 /mnt/data



when using mount, you can specify the user and group which owns the files, maybe you want to use the following:



sudo mount 192.168.20.5:/data /mnt/data -o uid=<uid-of-www-data>,gid=<gid-of-www-data>


the values uid and gid of www-data can be found in /etc/passwd and /etc/group.






share|improve this answer




















  • The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
    – roaima
    Aug 22 '17 at 22:54

















up vote
-1
down vote













You can do chmod 6777 on the shared folder from the nfs server, so that any files being created on the file belongs to the owner group of the folder.






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f154679%2fpermissions-on-a-mounted-nfs-share%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    per your comment I think the following option is better than chmod -R 775 /mnt/data



    when using mount, you can specify the user and group which owns the files, maybe you want to use the following:



    sudo mount 192.168.20.5:/data /mnt/data -o uid=<uid-of-www-data>,gid=<gid-of-www-data>


    the values uid and gid of www-data can be found in /etc/passwd and /etc/group.






    share|improve this answer




















    • The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
      – roaima
      Aug 22 '17 at 22:54














    up vote
    0
    down vote













    per your comment I think the following option is better than chmod -R 775 /mnt/data



    when using mount, you can specify the user and group which owns the files, maybe you want to use the following:



    sudo mount 192.168.20.5:/data /mnt/data -o uid=<uid-of-www-data>,gid=<gid-of-www-data>


    the values uid and gid of www-data can be found in /etc/passwd and /etc/group.






    share|improve this answer




















    • The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
      – roaima
      Aug 22 '17 at 22:54












    up vote
    0
    down vote










    up vote
    0
    down vote









    per your comment I think the following option is better than chmod -R 775 /mnt/data



    when using mount, you can specify the user and group which owns the files, maybe you want to use the following:



    sudo mount 192.168.20.5:/data /mnt/data -o uid=<uid-of-www-data>,gid=<gid-of-www-data>


    the values uid and gid of www-data can be found in /etc/passwd and /etc/group.






    share|improve this answer












    per your comment I think the following option is better than chmod -R 775 /mnt/data



    when using mount, you can specify the user and group which owns the files, maybe you want to use the following:



    sudo mount 192.168.20.5:/data /mnt/data -o uid=<uid-of-www-data>,gid=<gid-of-www-data>


    the values uid and gid of www-data can be found in /etc/passwd and /etc/group.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 12 '14 at 12:36









    Sebastian

    5,12832747




    5,12832747











    • The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
      – roaima
      Aug 22 '17 at 22:54
















    • The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
      – roaima
      Aug 22 '17 at 22:54















    The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
    – roaima
    Aug 22 '17 at 22:54




    The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
    – roaima
    Aug 22 '17 at 22:54












    up vote
    -1
    down vote













    You can do chmod 6777 on the shared folder from the nfs server, so that any files being created on the file belongs to the owner group of the folder.






    share|improve this answer
























      up vote
      -1
      down vote













      You can do chmod 6777 on the shared folder from the nfs server, so that any files being created on the file belongs to the owner group of the folder.






      share|improve this answer






















        up vote
        -1
        down vote










        up vote
        -1
        down vote









        You can do chmod 6777 on the shared folder from the nfs server, so that any files being created on the file belongs to the owner group of the folder.






        share|improve this answer












        You can do chmod 6777 on the shared folder from the nfs server, so that any files being created on the file belongs to the owner group of the folder.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 11 '17 at 6:21









        sunical

        1




        1



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f154679%2fpermissions-on-a-mounted-nfs-share%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?