更改Linux中现有进程的所有者 [英] Changing the owner of an existing process in Linux

查看:104
本文介绍了更改Linux中现有进程的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以特权用户身份启动tomcat(Web服务器),然后将其重新带给非特权用户.有没有办法以编程方式或通常在Linux上做到这一点?

I would like to start tomcat (Web Server) as a privileged user, and then bring it back to an unprivileged user once it has started. Is there a way to do this programatically, or in general with Linux?

谢谢.

推荐答案

我知道 kchuid 确实做到了这一点,尽管它似乎已被废弃,但看起来很难更新.

I am aware of kchuid which does exactly that, and although it appears abandoned, it doesn't look like it would be hard to bring up-to-date.

也就是说,我工作的托管公司确实允许用户(在共享托管程序包上)在端口80上运行自己的网络服务器(包括Tomcat).这使用称为 authbind 的工具来完成.不需要服务器以root身份启动,而只需让非root用户绑定到选定的IP地址和选定的端口即可.

That said, the hosting company I work for does allow (on the shared hosting packages) users to run their own webserver- including Tomcat- on port 80. This is done using a tool called authbind which doesn't require the server start as root- but simply lets non-root users bind to selected IP addresses and selected ports.

唯一的收获是 authbind 不适用于Java的网络抽象层默认情况下.您将需要禁用Java的IPV6支持,并可能指定一个特定的 IP地址以绑定到您的应用程序中.前者可以通过以-Djava.net.preferIPv4Stack=true启动JRE来完成,而后者是特定于应用程序的.

The only catch is that authbind won't work with Java's network abstraction layer by default. You will need to disable Java's IPV6 support, and probably specify a specific IP address to bind to within your application. The former can be done by starting the JRE with -Djava.net.preferIPv4Stack=true but the latter is application-specific.

这篇关于更改Linux中现有进程的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆