seteuid and file ownership

Vishal Jain vxj45@hotmail.com
Thu Mar 20 23:50:00 GMT 2003


You are right. seteuid is failing.
I have given vishalj the following rights as mentioned in user doc
An important restriction is that the application using LogonUser must have
special permissions:

"Act as part of the operating system"
"Replace process level token"
"Increase quotas"

Also user vishalj belongs to Administrators group.
/etc/passwd has that information.
Are there any more priveleges I need to give?
thanks,
Vishal


-----Original Message-----
From: Andrew DeFaria [mailto:ADeFaria@Salira.com]
Sent: Thursday, March 20, 2003 1:17 PM
To: cygwin@cygwin.com
Subject: Re: seteuid and file ownership


You might start by checking the status after the setuid call. Perhaps it
failed.

Vishal Jain wrote:

>Hi,
>I am making a seteuid() call to impersonate user "shweta".
>Then I create a file. When I do ls -l on the file, it shows the owner as
>"vishalj" which was the user before doing impersonation.
>-rw-rw-rw-    1 vishalj  mkgroup         0 Mar 20 12:50 shweta
>Is this expected behaviour in cygwin?
>I am attaching the code snippet-
>
>#include <windows.h>
>#include <sys/cygwin.h>
>#include <stdio.h>
>#include <pwd.h>
>
>int main(int argc, char *argv[]){
>     HANDLE token = INVALID_HANDLE_VALUE;
>     struct passwd *pw = NULL;
>     FILE *fp = NULL;
>     pw = getpwnam("shweta");
>     token = cygwin_logon_user(pw, "shweta");
>     if(token == INVALID_HANDLE_VALUE){
>         printf("Login failed\n");
>     }
>     cygwin_set_impersonation_token(token);
>     seteuid(pw->pw_uid);
>     fp = fopen("shweta", "w");
>     if(fp == NULL){
>         printf("could not open file for writing\n");
>     }
>     fclose(fp);
>}
>
>Thanks,
>Vishal




_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list