[英]How can run my web application in tomcat with a different user than tomcat?
What Ian wanted to do is run some external program or command from my WEB application (.sh, .pl even use directly ProcessBuilder or Runtime) Ian想要做的是从我的WEB应用程序中运行一些外部程序或命令(.sh,.pl甚至直接使用ProcessBuilder或Runtime)
I achived to run the program or commands in my server, but the problem is that all of then are running as tomcat user. 我可以在服务器上运行程序或命令,但是问题是所有这些都以tomcat用户身份运行。 Then, for instance when I try to use ssh with public key I need to do a sudo -u "user" and then run the program or command.
然后,例如,当我尝试将ssh与公共密钥一起使用时,我需要执行sudo -u“ user”,然后运行程序或命令。 But unfortunatelly, I dont know why, it deesn't work.
但不幸的是,我不知道为什么,它不起作用。
After three days of troubleshooting, prof&error and google it, I'm thinking to run my application or procces wit a diferent user, thus avoid to use sudo command. 经过三天的故障排除,prof&error和google之后,我正在考虑运行我的应用程序或使用其他用户进行处理,因此避免使用sudo命令。
Then, I would like to know if somebody could tell me how I can do it or if there is any other best way to do that. 然后,我想知道是否有人可以告诉我我该怎么做,或者是否有其他最佳方法可以做到这一点。
Finally what I've done is to exacute my ssh throught JSch and public key authentication. 最后,我要做的是通过JSch和公钥身份验证执行ssh。 On this way I dont need to use sudo command since I can point out my user and private key.
这样我就不需要使用sudo命令,因为我可以指出我的用户和私钥。 Oviously it's not run tomcat with different user but it fix my problem.
显然,它不是用其他用户运行tomcat的,但是它可以解决我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.