Using setuid on smbd

Henrik Zagerholm henke at mac.se
Thu Jul 12 20:48:53 GMT 2007


12 jul 2007 kl. 17:08 skrev simo:

> On Thu, 2007-07-12 at 15:30 +0200, Henrik Zagerholm wrote:
>> Hello list,
>>
>> I wonder if it is a really bad idea to setuid bit on samba daemons to
>> make them start with root privileges?
>>
>> I need it in an embedded systems where the daemons are started by a
>> non root user and I don't have access to sudo etc and we all know
>> that smbd should run under root.
>
> Make a simple setuid helper in C that take care of starting the  
> daemons,
> should be a few lines of code.
>
Ahh maybe something like this
#include <sys/types.h>
#include <unistd.h>
main(argc, argv)
char **argv;
{
   setuid( 0 );
   setgid( 0 );
   execv( "/usr/samba/sbin/smbd", argv );
}

Then set setuid bit on my little C program. Correct?
//Thanks, Henrik

> Simo.
>
> -- 
> Simo Sorce
> Samba Team GPL Compliance Officer
> email: idra at samba.org
> http://samba.org
>



More information about the samba-technical mailing list