mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-10 22:30:21 +00:00
lxc_unshare -u argument useful even with USER namespace shared
Signed-off-by: Seth Robertson <srobertson@appcomsci.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
00fe5e1d19
commit
13d8bde96f
@ -51,7 +51,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||||||
<cmdsynopsis>
|
<cmdsynopsis>
|
||||||
<command>lxc-unshare</command>
|
<command>lxc-unshare</command>
|
||||||
<arg choice="req">-s <replaceable>namespaces</replaceable></arg>
|
<arg choice="req">-s <replaceable>namespaces</replaceable></arg>
|
||||||
<arg choice="req">-u <replaceable>user</replaceable></arg>
|
<arg choice="opt">-u <replaceable>user</replaceable></arg>
|
||||||
<arg choice="req">command</arg>
|
<arg choice="req">command</arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
@ -100,8 +100,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Specify a user which the new task should become. This option is
|
Specify a userid which the new task should become.
|
||||||
only valid if a user namespace is unshared.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -97,7 +97,8 @@ static int do_start(void *arg)
|
|||||||
int flags = *start_arg->flags;
|
int flags = *start_arg->flags;
|
||||||
uid_t uid = *start_arg->uid;
|
uid_t uid = *start_arg->uid;
|
||||||
|
|
||||||
if (flags & CLONE_NEWUSER && setuid(uid)) {
|
// Setuid is useful even without a new user id space
|
||||||
|
if ( uid >= 0 && setuid(uid)) {
|
||||||
ERROR("failed to set uid %d: %s", uid, strerror(errno));
|
ERROR("failed to set uid %d: %s", uid, strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -153,8 +154,6 @@ int main(int argc, char *argv[])
|
|||||||
if (ret)
|
if (ret)
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
|
||||||
if (!(flags & CLONE_NEWUSER) && uid != -1) {
|
|
||||||
ERROR("-u <uid> needs -s USER option");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user