• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# chown<a name="EN-US_TOPIC_0000001179965847"></a>
2
3-   [Command Function](#section247414691513)
4-   [Syntax](#section14773151018159)
5-   [Parameters](#section598731391517)
6-   [Usage](#section16524152071510)
7-   [Example](#section17901152561510)
8-   [Output](#section15513163115816)
9
10## Command Function<a name="section247414691513"></a>
11
12This command is used to change the owner and group of a specified file.
13
14## Syntax<a name="section14773151018159"></a>
15
16chown \[_owner_\] \[_group_\] \[_pathname_\]
17
18## Parameters<a name="section598731391517"></a>
19
20**Table  1**  Parameter description
21
22<a name="table1049mcpsimp"></a>
23<table><thead align="left"><tr id="row1055mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p1057mcpsimp"><a name="p1057mcpsimp"></a><a name="p1057mcpsimp"></a><strong id="b130925344111510"><a name="b130925344111510"></a><a name="b130925344111510"></a>Parameter</strong></p>
24</th>
25<th class="cellrowborder" valign="top" width="52%" id="mcps1.2.4.1.2"><p id="p1059mcpsimp"><a name="p1059mcpsimp"></a><a name="p1059mcpsimp"></a><strong id="b1226032904716"><a name="b1226032904716"></a><a name="b1226032904716"></a>Description</strong></p>
26</th>
27<th class="cellrowborder" valign="top" width="27%" id="mcps1.2.4.1.3"><p id="p1061mcpsimp"><a name="p1061mcpsimp"></a><a name="p1061mcpsimp"></a><strong id="b34190246311510"><a name="b34190246311510"></a><a name="b34190246311510"></a>Value Range</strong></p>
28</th>
29</tr>
30</thead>
31<tbody><tr id="row1062mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p1064mcpsimp"><a name="p1064mcpsimp"></a><a name="p1064mcpsimp"></a>owner</p>
32</td>
33<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p13519122819294"><a name="p13519122819294"></a><a name="p13519122819294"></a>Specifies the file owner.</p>
34</td>
35<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p182181026104214"><a name="p182181026104214"></a><a name="p182181026104214"></a>[0, 0xFFFFFFFF]</p>
36</td>
37</tr>
38<tr id="row172161126124218"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p68901524203516"><a name="p68901524203516"></a><a name="p68901524203516"></a>group</p>
39</td>
40<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p1066mcpsimp"><a name="p1066mcpsimp"></a><a name="p1066mcpsimp"></a>Specifies the file group.</p>
41</td>
42<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p81831811183618"><a name="p81831811183618"></a><a name="p81831811183618"></a>Left blank</p>
43<p id="p1068mcpsimp"><a name="p1068mcpsimp"></a><a name="p1068mcpsimp"></a>[0, 0xFFFFFFFF]</p>
44</td>
45</tr>
46<tr id="row10616101153510"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p12217026154215"><a name="p12217026154215"></a><a name="p12217026154215"></a>pathname</p>
47</td>
48<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p4218826194210"><a name="p4218826194210"></a><a name="p4218826194210"></a>Specifies the file path.</p>
49</td>
50<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p13872195215290"><a name="p13872195215290"></a><a name="p13872195215290"></a>An existing file</p>
51</td>
52</tr>
53</tbody>
54</table>
55
56## Usage<a name="section16524152071510"></a>
57
58-   By specifying the  **owner**  and  **group**  parameters in this command, you can change the owner and group of the file.
59-   If  **owner**  or  **group**  is  **-1**, the owner or group of the file will not be changed.
60-   The  **group**  parameter can be left blank.
61
62## Example<a name="section17901152561510"></a>
63
64Run  **chown 100 200 hello-harmony.txt**.
65
66## Output<a name="section15513163115816"></a>
67
68**Figure  1**  Changing the owner and group of the hello-harmony.txt file to 100 and 200 respectively<a name="fig518593394920"></a>
69![](figure/changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively.png "changing-the-owner-and-group-of-the-hello-harmony-txt-file-to-100-and-200-respectively")
70
71