This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: seteuid and file ownership

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?

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

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

Vishal Jain wrote:

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[]){
    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");
    fp = fopen("shweta", "w");
    if(fp == NULL){
        printf("could not open file for writing\n");


Tired of spam? Get advanced junk mail protection with MSN 8.

-- Unsubscribe info: Bug reporting: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]