ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/chown.htm

167 lines
4.1 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>chown - Change file ownership</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>chown - Change file ownership</h2>
<strong>Synopsis</strong>
<p><strong>chown [-R [ -H | -L | -P ]] [ -h ]</strong> <em>
owner</em>[<em>:group</em>] <em>file ...</em></p>
<p><strong>Description</strong></p>
<p>You can use <strong>chown</strong> to set the owner of <em>
file</em> to the user identifier or profile specified by <em>
owner</em>. Optionally, <strong>chown</strong> can also set the
group of the <em>file</em> to the group identifier or profile
specified by <em>group</em>.</p>
<p>To change the owner of a file, you must have one of the
following authorities:</p>
<ul>
<li>The current user has *ALLOBJ special authority.</li>
<li>The current user is the owner of the file or directory.</li>
</ul>
<p>To change the group of a file, you must have one of the
following authorities:</p>
<ul>
<li>The current user has *ALLOBJ special authority.</li>
<li>The current user is the owner of <em>file</em> and either one
of the following:
<ul>
<li>The primary group of the job is <em>group</em>.</li>
<li>One of the supplemental groups of the job is <em>
group</em>.</li>
</ul>
</li>
</ul>
<p>In addition, the current user must have *USE authority to the
new user profile or group profile.</p>
<p>By default, <strong>chown</strong> follows symbolic links and
changes the owner and group of the file pointed to by the symbolic
link.</p>
<p><img src="delta.gif" alt="Start of change">
The group of a file cannot be the same as the owner of the file.
<img src="deltaend.gif" alt="End of change"></p>
<p><strong>Options</strong></p>
<dl>
<dt><strong>-H</strong></dt>
<dd>If the <strong>-R</strong> option is specified, symbolic links
on the command line are followed. Symbolic links encountered in the
tree traversal are not followed.</dd>
<dt><strong>-L</strong></dt>
<dd>If the <strong>-R</strong> option is specified, both symbolic
links on the command line and symbolic links encountered in the
tree traversal are followed.</dd>
<dt><strong>-P</strong></dt>
<dd>If the <strong>-R</strong> option is specified, no symbolic
links are followed.</dd>
<dt><strong>-R</strong></dt>
<dd>If <em>file</em> designates a directory, <strong>chown</strong>
recursively changes the owner and group of each file in the entire
subtree connected at that point.</dd>
<dt><strong>-h</strong></dt>
<dd>Change the owner and group of a symbolic link instead of the
file pointed to by the symbolic link.</dd>
</dl>
<p><strong>Operands</strong></p>
<p>The <em>owner</em> operand specifies either a user identifer
number or a user profile name. The <em>group</em> operand specifies
either a group identifier number or a group profile name. The <em>
file</em> operand specifies a path name to an object.</p>
<p><strong>Exit Status</strong></p>
<ul>
<li>0 when successful and all requested changes were made.</li>
<li>&gt;0 when an error occurred.</li>
</ul>
<p><strong>Related information</strong></p>
<ul>
<li><a href="chgrp.htm">chgrp - Change file group
permission</a></li>
<li><a href="chmod.htm">chmod - Change file modes
(permissions)</a></li>
</ul>
<strong>Examples</strong>
<ol>
<li>Change the owner to user profile "sam" for the file
"personal.file".
<pre>
chown sam personal.file
</pre>
</li>
<li>Recursively change the owner to user profile "larry" for the
sub-directory "moe.dir" and all files and sub-directories below
this directory.
<pre>
chown -R larry moe.dir
</pre>
</li>
<li>Change the owner to user identifier "500" for the file
"your.file".
<pre>
chown 500 your.file
</pre>
</li>
<li>Change the owner to user profile "sam" and the group to group
profile "abbey" for the file "memo.txt".
<pre>
chown sam:abbey memo.txt
</pre>
</li>
</ol>
<!-- end ibmbody========================================================= -->
</body>
</html>