A tomcat server that is run as root (i.e. web app using port 80) needs access to an NFS share to store uploaded files, which the root account does not have access to. Unsurprisingly, when the web application attempts to store a file, a permission exception is thrown.

Can I mount the share as a non-root user, so that the web server is able to access the share without permissions issues?

link|improve this question
feedback

2 Answers

On the NFS server, change the export and add a -maproot=some_user option. This will make it so any "root" user accessing the share will be given the access rights "some_user" would normally have.

link|improve this answer
Unfortunately, while this is probably the solution, this isn't a possibility due to IT's policies... :( – brass-kazoo Jan 12 at 2:05
feedback

An alternative solution could be to run tomcat on a port >1000 so it can run as the user with access to the NFS share.

An Apache or nginx instance could then serve on port 80 and proxy the requests to the web application.

link|improve this answer
Seconded/voted up; running tomcat as root is strongly discouraged. – BeeDee Jan 12 at 6:15
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.