Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chown problem



Isn't deletion an x priv?

I have some ftp users, and they can overwrite files, but not add new ones, so I guess I assume that creating new files and deleting old ones are x of the (-rw)-r--r- part.


On Thursday, Sep 5, 2002, at 17:34 US/Eastern, Michael Domino wrote:

Hello,

I am running a daemon on startup (so it's running as root), and I would
like to create files and set them to be owned by whomever is logged in
at the console. I wrote this code:

if ( GetFullPathname(&newSpec, pathname, 2 ) )
{
char* loginName = getlogin();
CopyPascalStringToC(pathname, pathname);
strcpy(command, "chown ");
if(loginName)
{
strcat(command, loginName);
strcat(command, " \"");
strcat(command, pathname);
strcat(command, "\"");
sprintf(errorCStr, "chown executing command: %s\n", command);
syslog(1, errorCStr);
err = system(command);
if(0 != err)
{
sprintf(errorCStr, "chown failed, err = %d.\n", err, theErr);
syslog(1, errorCStr);
}
}

When I check to see who owns the file using ls -l, sure enough it is
owned by the current console login, with -rw-r--r-- permissions, but
when I am logged in as that user, rm reports "permission denied" when I
try to delete the file. Can anyone explain why this is happening?

Also, how would I go about getting a list of the groups a user is a
member of, from a c program? I know I could do a system call "id -Gn
username" and write the output to a file, but is there a way to get the
list directly?

Thanks for your help,
Michael
_______________________________________________
darwin-userlevel mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-userlevel
Do not post admin requests to the list. They will be ignored.


------------------------------------------------------------------------ ------
Thomas Ingham (aim-inghamtom) (msn-ingham_thomas)
Web Developer - Coalmarch Productions
http://www.coalmarch.com
919-522-8027
_______________________________________________
darwin-userlevel mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-userlevel
Do not post admin requests to the list. They will be ignored.
References: 
 >chown problem (From: Michael Domino <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.