logo

skeud

Simple and portable utilities to deal with user accounts (su, login)
commit: 496ec40ffce5f0d5745c83276358741527d5e15b
parent 380bdc6c3b4c7dd4c3abb6478b36a9cb8593d431
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 10 Sep 2023 13:12:43 +0200

su: Restrict [-s shell] to super-user

Diffstat:

Msu.c6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/su.c b/su.c @@ -54,6 +54,12 @@ main(int argc, char *argv[]) username = optarg; break; case 's': // shell + if(getuid() != 0) + { + fprintf(stderr, "su: Only the super-user can override the target shell"); + return 1; + } + shell = optarg; break; case 'p': // preserve environment