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

Mono.Unix.UnixFileSystemInfo.SetOwner Method

Set the owner user ID and owner group ID of UnixFileSystemInfo.FullName.

public void SetOwner (string owner, string group)

See Also

UnixUserInfo
UnixGroupInfo
Mono.Unix.Native.Syscall.chown

Parameters

owner
A string containing the user name of the owner user id to use.
group
A string containing the group name of the owner group id to use.

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]
UnauthorizedAccessExceptionSearch permission is denied for a component of the path UnixFileSystemInfo.FullName. [Mono.Unix.Native.Errno.EACCES]
System.IO.DirectoryNotFoundException A component of the path prefix of UnixFileSystemInfo.FullName is not a directory. [Mono.Unix.Native.Errno.ENOTDIR]
System.IO.FileNotFoundException A component of UnixFileSystemInfo.FullName that must exist does not exist. [Mono.Unix.Native.Errno.ENOENT]
System.IO.IOException

UnixFileSystemInfo.FullName 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]

System.IO.PathTooLongExceptionUnixFileSystemInfo.FullName was too long. [Mono.Unix.Native.Errno.ENAMETOOLONG]
Mono.Unix.UnixIOException

Too many symbolic links were encountered in translating UnixFileSystemInfo.FullName. [Mono.Unix.Native.Errno.ELOOP]

-or-

An attempt was made to set the sticky bit upon an executable. [Mono.Unix.Native.Errno.EFTYPE]

Remarks

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

Classes deriving from Mono.Unix.UnixFileSystemInfo can change this method to operate on a different file. This default version will follow symbolic links, changing the permissions of the symbolic link target instead of the symbolic link itself. UnixSymbolicLinkInfo.SetOwner changes permissions on the symbolic link itself.

Requirements

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