Signed-off-by: Seth Robertson <srobertson@appcomsci.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
<cmdsynopsis>
<command>lxc-unshare</command>
<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>
</cmdsynopsis>
</refsynopsisdiv>
</term>
<listitem>
<para>
- Specify a user which the new task should become. This option is
- only valid if a user namespace is unshared.
+ Specify a userid which the new task should become.
</para>
</listitem>
</varlistentry>
int flags = *start_arg->flags;
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));
exit(1);
}
if (ret)
usage(argv[0]);
- if (!(flags & CLONE_NEWUSER) && uid != -1) {
- ERROR("-u <uid> needs -s USER option");
return 1;
}