Re: migrate to tomcat 9: application can not write files on system filder
Thanks for all people who replied to my question. I took Emmanuel Bourg's advice that did the trick. It works! On Monday, July 1, 2019, 02:53:11 PM PDT, Emmanuel Bourg wrote: Le 01/07/2019 à 19:55, W a écrit : > Hi,I am migrate from ubuntu 16.04 (server), mysql 5.7 and tomcat 8 to ubuntu > 18.04(server), mysql 8 and tomcat 9. > My application works on old system. Now when my application tries to write a > file on > a directory (permission allowed), there is an > error:java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: Read-only > file system The tomcat9 package on Debian/Ubuntu uses systemd and leverages its sandboxing feature to limit the write access to the conf, log, work and webapps directories by default. If you look at the package's README file (/usr/share/doc/tomcat9/README.Debian) you'll find the instructions to grant Tomcat write access to other directories: https://salsa.debian.org/java-team/tomcat9/blob/master/debian/README.Debian If write access to other directories is required the service settings have to be overridden. This is done by creating an override.conf file in /etc/systemd/system/tomcat9.service.d/ containing: [Service] ReadWritePaths=/path/to/the/directory/ The service has to be restarted afterward with: systemctl daemon-reload systemctl restart tomcat9 Emmanuel Bourg - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: migrate to tomcat 9: application can not write files on system filder
Le 01/07/2019 à 19:55, W a écrit : > Hi,I am migrate from ubuntu 16.04 (server), mysql 5.7 and tomcat 8 to ubuntu > 18.04(server), mysql 8 and tomcat 9. > My application works on old system. Now when my application tries to write a > file on > a directory (permission allowed), there is an > error:java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: Read-only > file system The tomcat9 package on Debian/Ubuntu uses systemd and leverages its sandboxing feature to limit the write access to the conf, log, work and webapps directories by default. If you look at the package's README file (/usr/share/doc/tomcat9/README.Debian) you'll find the instructions to grant Tomcat write access to other directories: https://salsa.debian.org/java-team/tomcat9/blob/master/debian/README.Debian If write access to other directories is required the service settings have to be overridden. This is done by creating an override.conf file in /etc/systemd/system/tomcat9.service.d/ containing: [Service] ReadWritePaths=/path/to/the/directory/ The service has to be restarted afterward with: systemctl daemon-reload systemctl restart tomcat9 Emmanuel Bourg - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: migrate to tomcat 9: application can not write files on system filder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Wayne, On 7/1/19 13:55, W wrote: > Hi,I am migrate from ubuntu 16.04 (server), mysql 5.7 and tomcat 8 > to ubuntu 18.04(server), mysql 8 and tomcat 9. My application works > on old system. Now when my application tries to write a file on a > directory (permission allowed), there is an > error:java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: > Read-only file system Exception: java.nio.file.FileSystemException: > /photoLogos/PERSON/-_~x: Read-only file system > java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: > Read-only file system at > java.base/sun.nio.fs.UnixException.translateToIOException(UnixExceptio n.java:100) > > at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.ja va:111) > at > java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException. java:116) > > at java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:248) > at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:493) at > java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvide r.java:263) > > at java.base/java.nio.file.Files.move(Files.java:1421)I can ssh to the server, manually write/read files on that directory. The directory > is set (for debug) as every one can write/read. So I belief that > the error is due to settings of tomcat 9.I need help. Any > information would be appreciated. Thanks in advance. Wayne > What do you get when you run: $ ls -l '/photoLogos/PERSON/-_~x' What is the euid/egid of the running Tomcat server? - -chris -BEGIN PGP SIGNATURE- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl0aduUACgkQHPApP6U8 pFhwPRAAyQQjY5Q+KfO9GPsgrPDbPYxHDjdW+Rqp2uGXqLDB0FybrEnpEQ44/zYp 6UaysuuWvvZkne3bKXZVLaiMmXVtjVg0XTR8X1WtLgTddbLP+c76Uu80o/TY64py EmkzbOj6O5ZQQ9xEUxPYE/iPcpGGAETl1/QwK73UfYtf9K1VcNajDrE4RZjgmXLp 5QV0trofkQ5sGLBa5PVyf27HkWpy2zkYEXmpybxyQl3bzBJy3pNYZcZje1736Nv8 CrSEso5+bOWSf3BuwfS6xZ2xsc9xrw2+mX5ZN2z1KgRako7Da3HPkyipe4424Hfr hjUd/+CsSiNNO3phP5TSwJYJ+JRQ7pOLB3iw36oypxUi8F1CRAvVfgXhVraDD7vK 34IShRFIFgXDW499J0lQPiDeR0lu5riIlguLvvoKimHl8njs5SMUttSh8ltArhhz J1svJunsarBojjoijhP6CDQwIxQQIoUmh9LOKuMJtMRQMZOIMwPWHE5gzL/+B9pA jghOZPl6OPRZs4sQseb1jA8jl3nGrwcpSqm0gIjAEph4BzgB4Mr/6kAFxiTCvDqe aswp1kDynD2peF8RAfv3/vkVlv6tl4EwfoYXzckxfIvZwtL2BUyPg+B6l9Cz4rZV ZlwItI57c2OXPnw9Ul7115zkFRSA8FnYwvsVooBjcvRztf1Ks4Q= =O61T -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
migrate to tomcat 9: application can not write files on system filder
Hi,I am migrate from ubuntu 16.04 (server), mysql 5.7 and tomcat 8 to ubuntu 18.04(server), mysql 8 and tomcat 9. My application works on old system. Now when my application tries to write a file on a directory (permission allowed), there is an error:java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: Read-only file system Exception: java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: Read-only file system java.nio.file.FileSystemException: /photoLogos/PERSON/-_~x: Read-only file system at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) at java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:248) at java.base/sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:493) at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:263) at java.base/java.nio.file.Files.move(Files.java:1421)I can ssh to the server, manually write/read files on that directory. The directory is set (for debug) as every one can write/read. So I belief that the error is due to settings of tomcat 9.I need help. Any information would be appreciated. Thanks in advance. Wayne