Mono Class Library: Mono.Unix.UnixStream Overview | Members

Mono.Unix.UnixStream.SetOwner Method

Set the owner user ID and owner group ID of UnixStream.Handle.

public void SetOwner (string user)

See Also

UnixUserInfo
Mono.Unix.Native.Syscall.chown

Parameters

user
A string containing the user name to use for the new user-id and group-id.

Exceptions

TypeReason
InvalidOperationException The effective user ID does not match the owner of the file and the effective user ID is not the super-user. [Mono.Unix.Native.Errno.EPERM]
ObjectDisposedException The stream has been closed.
System.IO.FileNotFoundException A component of UnixStream.Handle that must exist does not exist. [Mono.Unix.Native.Errno.ENOENT]
System.IO.IOException

UnixStream.Handle resides on a read-only file system. [Mono.Unix.Native.Errno.EROFS]

-or-

An I/O error occurred while making the directory entry or allocating the inode. [Mono.Unix.Native.Errno.EIO]

Remarks

The user user is looked up in the local password database and the resulting UnixUserInfo.UserId and UnixUserInfo.GroupId are used as the new owner user id and owner group id for UnixStream.Handle.

If this is called by the non-super user (usually the root user), then the FileSpecialAttributes.SetUserId and FileSpecialAttributes.SetGroupId bits are cleared.

Requirements

Namespace: Mono.Unix
Assembly: Mono.Posix (in Mono.Posix.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0