Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 1998 13:45:30 -0700 (PDT)
From:      Doug White <>
To:        Jordan Krushen <>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Setuid shell script problem
Message-ID:  <>
In-Reply-To: <000201bde1a0$82062660$>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Wed, 16 Sep 1998, Jordan Krushen wrote:

> I have a setuid shell script which doesn't seem to be running as the owner's
> uid.. I'm sure I'm missing something, and I'm not sure what.  Could anyone
> help this new-to-suid-scripts user get this to work? I know this a
> script-specific thing.. if i copy /usr/bin/id to my home dir and make it run
> suid root, I get:

suid shell scripts are a *bad* idea.  In addition the system ignores the
suid bit if you try to run scripts directly.  Use the command

sh . ./test


> uid=1000(wired) euid=0(root) gid=1000(wired) groups=1000(wired), 0(wheel),
> 7(bin), 1011(samba), 1024(admin)
> which is correct, but through the script I get the following:
> # ls -l test
> -rwsr-x---  1 root  bin  13 Sep 16 01:34 test
> # cat test
> #!/bin/sh -
> /usr/bin/id
> # ./test
> uid=1000(wired) gid=1000(wired) groups=1000(wired), 0(wheel), 7(bin),
> 1011(samba), 1024(admin)

Doug White                               
Internet:    | FreeBSD: The Power to Serve    |

To Unsubscribe: send mail to
with "unsubscribe freebsd-questions" in the body of the message

Want to link to this message? Use this URL: <>