Method: File.chown
- Defined in:
- file.c
.chown(owner_int, group_int, file_name, ...) ⇒ Integer
Changes the owner and group of the named file(s) to the given numeric owner and group id’s. Only a process with superuser privileges may change the owner of a file. The current owner of a file may change the file’s group to any group to which the owner belongs. A nil or -1 owner or group id is ignored. Returns the number of files processed.
File.chown(nil, 100, "testfile")
2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 |
# File 'file.c', line 2756
static VALUE
rb_file_s_chown(int argc, VALUE *argv, VALUE _)
{
struct chown_args arg;
apply2args(2);
arg.owner = to_uid(*argv++);
arg.group = to_gid(*argv++);
return apply2files(chown_internal, argc, argv, &arg);
}
|