Re: NSFileOwnerAccountName will not assign to root
Re: NSFileOwnerAccountName will not assign to root
- Subject: Re: NSFileOwnerAccountName will not assign to root
- From: Fritz Anderson <email@hidden>
- Date: Tue, 20 Mar 2012 21:00:16 -0500
On 20 Mar 2012, at 8:52 PM, Prime Coderama wrote:
> Does anyone know why the assignment of NSFileOwnerAccountName and NSFileGroupOwnerAccountName does not work? The directory created defaults to my account and the staff group.
>
> NSFileManager *fileManager = [NSFileManager defaultManager];
> NSMutableDictionary *attr = [NSMutableDictionary dictionary];
> [attr setObject:@"root" forKey:NSFileOwnerAccountName];
> [attr setObject:@"wheel" forKey:NSFileGroupOwnerAccountName];
> [attr setObject:[NSNumber numberWithInt:0755] forKey:NSFilePosixPermissions];
>
> [fileManager createDirectoryAtPath:dir withIntermediateDirectories:TRUE attributes:attr error:&error];
Standard UNIX privileges, which I don't have time or space to treat in full. You can't change the owner of a file, or act as another owner, without obtaining root/admin privileges.
You can UNIX permissions by Google. On OS X, look up Security.framework.
— F
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden