D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
FileUtils
/
Filename :
chown-c.ri
back
Copy
U:RDoc::AnyMethod[iI" chown:ETI"FileUtils::chown;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"MChanges the owner and group on the entries at the paths given in +list+ ;TI"*(a single path or an array of paths) ;TI"&to the given +user+ and +group+; ;TI"Areturns +list+ if it is an array, <tt>[list]</tt> otherwise:;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"6Modifies each entry that is a regular file using ;TI"'{File.chown}[rdoc-ref:File.chown].;To;;0; [o; ; [I"7Modifies each entry that is a symbolic link using ;TI"){File.lchown}[rdoc-ref:File.lchown].;T@o; ; [I"%Argument +list+ or its elements ;TI"Kshould be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].;T@o; ; [I"User and group:;T@o;; ;;[o;;0; [o; ; [I"6Argument +user+ may be a user name or a user id; ;TI"/if +nil+ or +-1+, the user is not changed.;To;;0; [o; ; [I"9Argument +group+ may be a group name or a group id; ;TI"0if +nil+ or +-1+, the group is not changed.;To;;0; [o; ; [I",The user must be a member of the group.;T@o; ; [I"Examples:;T@o:RDoc::Markup::Verbatim; [I"# One path. ;TI"'# User and group as string names. ;TI")File.stat('src0.txt').uid # => 1004 ;TI")File.stat('src0.txt').gid # => 1004 ;TI"4FileUtils.chown('user2', 'group1', 'src0.txt') ;TI")File.stat('src0.txt').uid # => 1006 ;TI")File.stat('src0.txt').gid # => 1005 ;TI" ;TI"&# User and group as uid and gid. ;TI"-FileUtils.chown(1004, 1004, 'src0.txt') ;TI")File.stat('src0.txt').uid # => 1004 ;TI")File.stat('src0.txt').gid # => 1004 ;TI" ;TI"# Array of paths. ;TI";FileUtils.chown(1006, 1005, ['src0.txt', 'src0.dat']) ;TI" ;TI""# Directory (not recursive). ;TI"-FileUtils.chown('user2', 'group1', '.') ;T:@format0o; ; [I"Keyword arguments:;T@o;; ;;[o;;0; [o; ; [I"F<tt>noop: true</tt> - does not change permissions; returns +nil+.;To;;0; [o; ; [I";<tt>verbose: true</tt> - prints an equivalent command:;T@o;; [ I"OFileUtils.chown('user2', 'group1', 'src0.txt', noop: true, verbose: true) ;TI"HFileUtils.chown(1004, 1004, 'src0.txt', noop: true, verbose: true) ;TI"VFileUtils.chown(1006, 1005, ['src0.txt', 'src0.dat'], noop: true, verbose: true) ;TI"IFileUtils.chown('user2', 'group1', path, noop: true, verbose: true) ;TI"HFileUtils.chown('user2', 'group1', '.', noop: true, verbose: true) ;T;0o; ; [I"Output:;T@o;; [ I"!chown user2:group1 src0.txt ;TI"chown 1004:1004 src0.txt ;TI"'chown 1006:1005 src0.txt src0.dat ;TI"!chown user2:group1 src0.txt ;TI"chown user2:group1 . ;T;0o; ; [I" Related: FileUtils.chown_R.;T: @fileI"lib/fileutils.rb;T:0@omit_headings_from_table_of_contents_below000[ I"1(user, group, list, noop: nil, verbose: nil);T@tFI"FileUtils;TcRDoc::NormalModule00