Linux catalina.out 中有很多(权限被拒绝)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4672082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 02:26:57  来源:igfitidea点击:

a lots of (Permission denied) in catalina.out

linuxapachepermission-deniedtomcat

提问by Mohammad Ali Akbari

How can i install Apache web server and Apache tomcat to avoid get errors like this:

java.io.FileNotFoundException: /usr/local/apache-tomcat-7.0.5/work/Catalina/localhost/_/SESSIONS.ser (Permission denied)

in /usr/local/apache-tomcat-7.0.5/logs/catalina.out

I think I should do something for Apache user, because when I chmod 777 -R ./on tomcat folder all errors disappear.

我如何安装 Apache Web 服务器和 Apache tomcat 以避免出现这样的错误:

java.io.FileNotFoundException: /usr/local/apache-tomcat-7.0.5/work/Catalina/localhost/_/SESSIONS.ser (Permission denied)

在 /usr/local/apache-tomcat-7.0.5/logs/catalina.out

我想我应该为 Apache 用户做一些事情,因为当我chmod 777 -R ./打开tomcat 文件夹中的所有错误都消失了。

采纳答案by Noel

Can't vouch for the security of doing so, but

不能保证这样做的安全性,但是

$ cd /usr/local/tomcat/ #or /usr/shared/tomcat6, whatever your $TOMCAT_BASE dir
$ chown -R tomcat6 webapps temp logs work conf
$ chmod -R 777 webapps temp logs work conf

works a treatfor these situations.

工程请客针对这些情况。

My tomcat install was borked with permission errors, but throwing open the gates thusly fixed everything.

我的 tomcat 安装因权限错误而中断,但因此打开大门修复了一切。

回答by thecarpy

$ chmod -R 777 webapps temp logs work conf

Is VERY dangerous, do not do it, did I write "not do it" ? DO NOT DO IT! Guess where your tomcat-users.xml is with your usernames and plain-text passwords ?

很危险,不要做,我写了“不要做”吗?不要做!猜猜您的 tomcat-users.xml 与您的用户名和纯文本密码在哪里?

Giving world read-write-execute anywhere on UNIX except /tmp (and even then, in prod, NEVER do that either) is plain stupid. And, it makes your first line, chown -R tomcat6 completely useless.

在 UNIX 上的任何地方提供世界读写执行,除了 /tmp(即使那样,在产品中,也不要这样做)是很愚蠢的。而且,它使您的第一行 chown -R tomcat6 完全无用。

make sure tomcat runs as tomcat7 (it is tomcat6 for tomcat 6) and simply do:

确保 tomcat 作为 tomcat7 运行(对于 tomcat 6,它是 tomcat6)并且只需执行以下操作:

$ cd $TOMCAT_BASE
$ chown -R tomcat7:tomcat7 webapps temp logs work conf
$ chmod -R 660 webapps temp logs work conf

[EDIT] changed 770to 660following comment, because the files in question need not be executed.

[编辑] 更改770660以下注释,因为不需要执行有问题的文件。

If you want to be able to read, write, or execute stuff there, add yourself to the tomcat7 group.

如果您希望能够在那里读取、写入或执行内容,请将您自己添加到 tomcat7 组。

回答by B.Kaatz

Ran into a similar situation like this with an older Tomcat-6 implementation...

使用较旧的 Tomcat-6 实现遇到了类似的情况......

...
SEVERE: Error deploying web application directory host-manager
java.io.FileNotFoundException: /opt/tomcat-6/conf/Catalina/localhost/host-manager.xml (Permission denied)
...

And, the webapp XMLs were all there and the ownership and permissions were all "tomcat:tomcat" and "644".

而且,webapp XML 都在那里,所有权和权限都是“tomcat:tomcat”和“644”。

For me, the solution was to set the overall permissions to what Tomcat prefers, namely "0755".

对我来说,解决方案是将整体权限设置为 Tomcat 喜欢的,即“0755”。

And, as a note for the security-conscious, the server.xml for that implementation is using a JDBC Realm for authentication, so we don't even use tomcat-users.xml. So, it is the default file that comes with the installation and even commented out the default user accounts within it (e.g. "tomcat" and "manager"). I know in Tomcat-7, the accounts in tomcat-users.xml are commented by default.

而且,作为安全意识的注意事项,该实现的 server.xml 使用 JDBC 领域进行身份验证,因此我们甚至不使用 tomcat-users.xml。因此,它是安装附带的默认文件,甚至注释掉了其中的默认用户帐户(例如“tomcat”和“manager”)。我知道在 Tomcat-7 中,默认情况下 tomcat-users.xml 中的帐户是注释的。

HTH.

哈。