我可以在Java中的可运行线程上切换用户吗?
问题描述:
假设我需要在shell上运行它,
Suppose I need to run this on shell,
$ su <user>; cp /x /y;
是否可以在应用程序中与另一个Unix用户一起运行线程?
Is there a way to run threads with another unix user within the application ?
答
否.与UNIX进程相比,Java线程的粒度级别更高.拥有有效用户的流程.
No. Java threads are at a finer level of granularity than unix processes; it's processes that have an effective user.