From 12d56be5cc2996f3e02cf495e1004084bea2549a Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 11 Jun 2023 22:32:51 +0300 Subject: [PATCH] Userspace: init now sets user and group ids before running their shell --- userspace/init/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/userspace/init/main.cpp b/userspace/init/main.cpp index ea6b37838e..a1283fb7f5 100644 --- a/userspace/init/main.cpp +++ b/userspace/init/main.cpp @@ -131,6 +131,11 @@ int main() { printf("Welcome back %s!\n", user.name.data()); + if (setgid(user.gid) == -1) + perror("setgid"); + if (setuid(user.uid) == -1) + perror("setuid"); + execl(user.shell.data(), user.shell.data(), nullptr); perror("execl");