問題タブ [lchown]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
46 参照

c++ - Why does lchown() always fail on group in root process via xinetd?

I have a C++ application that summons a server on another machine via the xinetd service on Linux Centos5 64 bit. The summoned process is invoked as root, but I think it may be a root that does not have full capabilities because of what I observe in my application.

In my application, running as root via inetd invocation, I create a new file and link (each initially user root and group root) and then call lchown() successfully on the owner, but it always fails on the group with EPERMS, Operation not permitted. Combining the user and group into a single invocation of lchown() fails similarly.

The code in question in my application is like this:

The newly created files live in as NFS mounted directory with permissions like this after my code runs:

The gid 500 is the primary group for 'me', the other group being 'wheel'.

From the shell prompt, I can do chgrp logged in as root to group me with no issues.

Why does lchown() behave differently when my application is invoked via inetd? Note that the same application invoked as root via ssh properly sets the group owner of the file. Why is root via ssh different than root via xinetd?