Permissions on a mounted NFS share
Clash 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!
php nfs
 |Â
show 5 more comments
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!
php nfs
I suppose the warning is from a webserver? They typically run under a separate user, e.g.www
. You mounted usingsudo
, hence the mountpoint is owned byroot
. Please post the output ofls -ld /mnt/data
andsu <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 ofdata
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
 |Â
show 5 more comments
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!
php nfs
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
php nfs
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 usingsudo
, hence the mountpoint is owned byroot
. Please post the output ofls -ld /mnt/data
andsu <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 ofdata
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
 |Â
show 5 more comments
I suppose the warning is from a webserver? They typically run under a separate user, e.g.www
. You mounted usingsudo
, hence the mountpoint is owned byroot
. Please post the output ofls -ld /mnt/data
andsu <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 ofdata
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
 |Â
show 5 more comments
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
.
The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
â roaima
Aug 22 '17 at 22:54
add a comment |Â
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.
add a comment |Â
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
.
The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
â roaima
Aug 22 '17 at 22:54
add a comment |Â
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
.
The uid and gid options do not apply to NFS mounts. (Perhaps you're confusing NTFS?)
â roaima
Aug 22 '17 at 22:54
add a comment |Â
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
.
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
.
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
add a comment |Â
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
add a comment |Â
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.
add a comment |Â
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.
add a comment |Â
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.
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.
answered Dec 11 '17 at 6:21
sunical
1
1
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I suppose the warning is from a webserver? They typically run under a separate user, e.g.
www
. You mounted usingsudo
, hence the mountpoint is owned byroot
. Please post the output ofls -ld /mnt/data
andsu <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