[Mono-dev] Dropping privileges in linux
Robert Jordan
robertj at gmx.net
Wed Dec 21 05:36:18 EST 2005
Georgi,
> I am looking for a way to drop privileges of an assembly started as
> 'root' to a normal user. I found two possible solutions, but didn't
> succeed with either of them ...
>
> a) Using Syscall
>
> Syscall.setgid(1000);
> Syscall.setuid(1000);
>
> there 1000 is the uid and gid of an existing user.
>
> b) Using WindowsIdentity the way it is described here:
>
> http://pages.infinit.net/ctech/20040405-1133.html
>
> In either way I get a 'Segmentation fault' when I execute the
> assembly. I think there are some kind of memory permissions involved,
> because when I strace the execution of the assembly I see that the
> actual seuid and setgid calls are executed.
>
> Can anyone give me some hint what I'm doing wrong, or a way to surroud
> the problem? I'm running Debian 3.1 with mono 1.1.10.
Both (a) and (b) work for me. You may delete root's .wapi
directory and retry. If it still doesn't work, please post the
native stack trace you can obtain with gdb.
Robert
More information about the Mono-devel-list
mailing list