I with to create a new thread which will impersonate to another uid, execute a task and finish, while my main thread will keep is original uid all the time.
impersonation can easily be achieved by using
but how can I make sure that it won’t change my original uid from the main thread?
Threads cannot have separate user ids; only processes can. The data structure the kernel uses for process has a user id field, but the thread one doesn’t.
Threads are defined by
thread_info, which doesn’t have anything point to user credentials.