1

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?

brass-kazoo
  • 178
  • 6

2 Answers2

2

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.

Chris S
  • 77,337
  • 11
  • 120
  • 212
1

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.

brass-kazoo
  • 178
  • 6