(self, user)
return True
Once we know which username to use inside the container
        we need to check if it exists in the passwd file that will
        be used inside the container. Since we can override the
        usage of the container /etc/passwd and /etc/group with
        files passed from the host, then we must check if this
        username is in the appropriate file so:
        1. check if the passwd will be the one of the host system
           either because we passwd --hostauth or because we did
           --volume=/etc/passwd:/etc/passwd
        2. else we are using the container original /etc/passwd
        In either case the user specified may not exist, in which
        case we copy the passwd file to a new file and we create
        the intended user. The file is then passwd/mapped into
        the container.
Once we know which username to use inside the container
        we need to check if it exists in the passwd file that will
        be used inside the container. Since we can override the
        usage of the container /etc/passwd and /etc/group with
        files passed from the host, then we must check if this
        username is in the appropriate file so:
        1. check if the passwd will be the one of the host system
           either because we passwd --hostauth or because we did
           --volume=/etc/passwd:/etc/passwd
        2. else we are using the container original /etc/passwd
        In either case the user specified may not exist, in which
        case we copy the passwd file to a new file and we create
        the intended user. The file is then passwd/mapped into
        the container.
Once we know which username to use inside the container we need to check if it exists in the passwd file that will be used inside the container . Since we can override the usage of the container / etc / passwd and / etc / group with files passed from the host then we must check if this username is in the appropriate file so : 1 . check if the passwd will be the one of the host system either because we passwd -- hostauth or because we did -- volume = / etc / passwd : / etc / passwd 2 . else we are using the container original / etc / passwd In either case the user specified may not exist in which case we copy the passwd file to a new file and we create the intended user . The file is then passwd / mapped into the container .
def _setup_container_user(self, user):
        """Once we know which username to use inside the container
        we need to check if it exists in the passwd file that will
        be used inside the container. Since we can override the
        usage of the container /etc/passwd and /etc/group with
        files passed from the host, then we must check if this
        username is in the appropriate file so:
        1. check if the passwd will be the one of the host system
           either because we passwd --hostauth or because we did
           --volume=/etc/passwd:/etc/passwd
        2. else we are using the container original /etc/passwd
        In either case the user specified may not exist, in which
        case we copy the passwd file to a new file and we create
        the intended user. The file is then passwd/mapped into
        the container.
        """
        host_auth = NixAuthentication()
        (passwd, group) = self._select_auth_files()
        container_auth = NixAuthentication(passwd, group)
        if not user:
            user = "root"
        (valid_user, user_id) = self._user_from_str(user,
                                                    host_auth, container_auth)
        if not valid_user:
            Msg().err("Error: invalid syntax for user", user)
            return False
        if (self._is_mountpoint("/etc/passwd") or
                self._is_mountpoint("/etc/group")):
            self.opt["hostauth"] = self.opt["containerauth"] = False
            return True
        if self.opt["user"]:
            if self.opt["user"] != "root":
                self.opt["uid"] = str(HostInfo.uid)
                self.opt["gid"] = str(HostInfo.gid)
        else:
            if self.opt["hostauth"] or self.opt["containerauth"]:
                Msg().err("Error: user not found")
                return False
            self.opt["user"] = user_id["user"] if "user" in user_id else user
            self.opt["uid"] = user_id["uid"] if "uid" in user_id else ""
            self.opt["gid"] = user_id["gid"] if "gid" in user_id else ""
        self._create_user(container_auth, host_auth)
        return True
def _setup_container_user ( self , user ) : host_auth = NixAuthentication ( ) ( passwd , group ) = self . _select_auth_files ( ) container_auth = NixAuthentication ( passwd , group ) if not user : user = "root" ( valid_user , user_id ) = self . _user_from_str ( user , host_auth , container_auth ) if not valid_user : Msg ( ) . err ( "Error: invalid syntax for user" , user ) return False if ( self . _is_mountpoint ( "/etc/passwd" ) or self . _is_mountpoint ( "/etc/group" ) ) : self . opt [ "hostauth" ] = self . opt [ "containerauth" ] = False return True if self . opt [ "user" ] : if self . opt [ "user" ] != "root" : self . opt [ "uid" ] = str ( HostInfo . uid ) self . opt [ "gid" ] = str ( HostInfo . gid ) else : if self . opt [ "hostauth" ] or self . opt [ "containerauth" ] : Msg ( ) . err ( "Error: user not found" ) return False self . opt [ "user" ] = user_id [ "user" ] if "user" in user_id else user self . opt [ "uid" ] = user_id [ "uid" ] if "uid" in user_id else "" self . opt [ "gid" ] = user_id [ "gid" ] if "gid" in user_id else "" self . _create_user ( container_auth , host_auth ) return True