source: proiecte/HadoopJUnit/hadoop-0.20.1/docs/hdfs_permissions_guide.html @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 19.8 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<meta content="Apache Forrest" name="Generator">
6<meta name="Forrest-version" content="0.8">
7<meta name="Forrest-skin-name" content="pelt">
8<title>
9      HDFS Permissions Guide
10    </title>
11<link type="text/css" href="skin/basic.css" rel="stylesheet">
12<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
13<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
14<link type="text/css" href="skin/profile.css" rel="stylesheet">
15<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
16<link rel="shortcut icon" href="images/favicon.ico">
17</head>
18<body onload="init()">
19<script type="text/javascript">ndeSetTextSize();</script>
20<div id="top">
21<!--+
22    |breadtrail
23    +-->
24<div class="breadtrail">
25<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://hadoop.apache.org/">Hadoop</a> &gt; <a href="http://hadoop.apache.org/core/">Core</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
26</div>
27<!--+
28    |header
29    +-->
30<div class="header">
31<!--+
32    |start group logo
33    +-->
34<div class="grouplogo">
35<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
36</div>
37<!--+
38    |end group logo
39    +-->
40<!--+
41    |start Project Logo
42    +-->
43<div class="projectlogo">
44<a href="http://hadoop.apache.org/core/"><img class="logoImage" alt="Hadoop" src="images/core-logo.gif" title="Scalable Computing Platform"></a>
45</div>
46<!--+
47    |end Project Logo
48    +-->
49<!--+
50    |start Search
51    +-->
52<div class="searchbox">
53<form action="http://www.google.com/search" method="get" class="roundtopsmall">
54<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp; 
55                    <input name="Search" value="Search" type="submit">
56</form>
57</div>
58<!--+
59    |end search
60    +-->
61<!--+
62    |start Tabs
63    +-->
64<ul id="tabs">
65<li>
66<a class="unselected" href="http://hadoop.apache.org/core/">Project</a>
67</li>
68<li>
69<a class="unselected" href="http://wiki.apache.org/hadoop">Wiki</a>
70</li>
71<li class="current">
72<a class="selected" href="index.html">Hadoop 0.20 Documentation</a>
73</li>
74</ul>
75<!--+
76    |end Tabs
77    +-->
78</div>
79</div>
80<div id="main">
81<div id="publishedStrip">
82<!--+
83    |start Subtabs
84    +-->
85<div id="level2tabs"></div>
86<!--+
87    |end Endtabs
88    +-->
89<script type="text/javascript"><!--
90document.write("Last Published: " + document.lastModified);
91//  --></script>
92</div>
93<!--+
94    |breadtrail
95    +-->
96<div class="breadtrail">
97
98             &nbsp;
99           </div>
100<!--+
101    |start Menu, mainarea
102    +-->
103<!--+
104    |start Menu
105    +-->
106<div id="menu">
107<div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Getting Started</div>
108<div id="menu_1.1" class="menuitemgroup">
109<div class="menuitem">
110<a href="index.html">Overview</a>
111</div>
112<div class="menuitem">
113<a href="quickstart.html">Quick Start</a>
114</div>
115<div class="menuitem">
116<a href="cluster_setup.html">Cluster Setup</a>
117</div>
118<div class="menuitem">
119<a href="mapred_tutorial.html">Map/Reduce Tutorial</a>
120</div>
121</div>
122<div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Programming Guides</div>
123<div id="menu_1.2" class="menuitemgroup">
124<div class="menuitem">
125<a href="commands_manual.html">Commands</a>
126</div>
127<div class="menuitem">
128<a href="distcp.html">DistCp</a>
129</div>
130<div class="menuitem">
131<a href="native_libraries.html">Native Libraries</a>
132</div>
133<div class="menuitem">
134<a href="streaming.html">Streaming</a>
135</div>
136<div class="menuitem">
137<a href="fair_scheduler.html">Fair Scheduler</a>
138</div>
139<div class="menuitem">
140<a href="capacity_scheduler.html">Capacity Scheduler</a>
141</div>
142<div class="menuitem">
143<a href="service_level_auth.html">Service Level Authorization</a>
144</div>
145<div class="menuitem">
146<a href="vaidya.html">Vaidya</a>
147</div>
148<div class="menuitem">
149<a href="hadoop_archives.html">Archives</a>
150</div>
151</div>
152<div onclick="SwitchMenu('menu_selected_1.3', 'skin/')" id="menu_selected_1.3Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">HDFS</div>
153<div id="menu_selected_1.3" class="selectedmenuitemgroup" style="display: block;">
154<div class="menuitem">
155<a href="hdfs_user_guide.html">User Guide</a>
156</div>
157<div class="menuitem">
158<a href="hdfs_design.html">Architecture</a>
159</div>
160<div class="menuitem">
161<a href="hdfs_shell.html">File System Shell Guide</a>
162</div>
163<div class="menupage">
164<div class="menupagetitle">Permissions Guide</div>
165</div>
166<div class="menuitem">
167<a href="hdfs_quota_admin_guide.html">Quotas Guide</a>
168</div>
169<div class="menuitem">
170<a href="SLG_user_guide.html">Synthetic Load Generator Guide</a>
171</div>
172<div class="menuitem">
173<a href="libhdfs.html">C API libhdfs</a>
174</div>
175</div>
176<div onclick="SwitchMenu('menu_1.4', 'skin/')" id="menu_1.4Title" class="menutitle">HOD</div>
177<div id="menu_1.4" class="menuitemgroup">
178<div class="menuitem">
179<a href="hod_user_guide.html">User Guide</a>
180</div>
181<div class="menuitem">
182<a href="hod_admin_guide.html">Admin Guide</a>
183</div>
184<div class="menuitem">
185<a href="hod_config_guide.html">Config Guide</a>
186</div>
187</div>
188<div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Miscellaneous</div>
189<div id="menu_1.5" class="menuitemgroup">
190<div class="menuitem">
191<a href="api/index.html">API Docs</a>
192</div>
193<div class="menuitem">
194<a href="jdiff/changes.html">API Changes</a>
195</div>
196<div class="menuitem">
197<a href="http://wiki.apache.org/hadoop/">Wiki</a>
198</div>
199<div class="menuitem">
200<a href="http://wiki.apache.org/hadoop/FAQ">FAQ</a>
201</div>
202<div class="menuitem">
203<a href="releasenotes.html">Release Notes</a>
204</div>
205<div class="menuitem">
206<a href="changes.html">Change Log</a>
207</div>
208</div>
209<div id="credit"></div>
210<div id="roundbottom">
211<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
212<!--+
213  |alternative credits
214  +-->
215<div id="credit2"></div>
216</div>
217<!--+
218    |end Menu
219    +-->
220<!--+
221    |start content
222    +-->
223<div id="content">
224<div title="Portable Document Format" class="pdflink">
225<a class="dida" href="hdfs_permissions_guide.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
226        PDF</a>
227</div>
228<h1>
229      HDFS Permissions Guide
230    </h1>
231<div id="minitoc-area">
232<ul class="minitoc">
233<li>
234<a href="#Overview">Overview</a>
235</li>
236<li>
237<a href="#User+Identity">User Identity</a>
238</li>
239<li>
240<a href="#Understanding+the+Implementation">Understanding the Implementation</a>
241</li>
242<li>
243<a href="#Changes+to+the+File+System+API">Changes to the File System API</a>
244</li>
245<li>
246<a href="#Changes+to+the+Application+Shell">Changes to the Application Shell</a>
247</li>
248<li>
249<a href="#The+Super-User">The Super-User</a>
250</li>
251<li>
252<a href="#The+Web+Server">The Web Server</a>
253</li>
254<li>
255<a href="#On-line+Upgrade">On-line Upgrade</a>
256</li>
257<li>
258<a href="#Configuration+Parameters">Configuration Parameters</a>
259</li>
260</ul>
261</div>
262   
263<a name="N1000D"></a><a name="Overview"></a>
264<h2 class="h3">Overview</h2>
265<div class="section">
266<p>
267                The Hadoop Distributed File System (HDFS) implements a permissions model for files and directories that shares much of the POSIX model. Each file and directory is associated with an <em>owner</em> and a <em>group</em>. The file or directory has separate permissions for the user that is the owner, for other users that are members of the group, and for all other users. For files, the <em>r</em> permission is required to read the file, and the <em>w</em> permission is required to write or append to the file. For directories, the <em>r</em> permission is required to list the contents of the directory, the <em>w</em> permission is required to create or delete files or directories, and the <em>x</em> permission is required to access a child of the directory. In contrast to the POSIX model, there are no <em>sticky</em>, <em>setuid</em> or <em>setgid</em> bits for files as there is no notion of executable files. For directories, there no <em>sticky</em>, <em>setuid</em> or <em>setgid</em> bits directory as a simplification. Collectively, the permissions of a file or directory are its <em>mode</em>. In general, Unix customs for representing and displaying modes will be used, including the use of octal numbers in this description. When a file or directory is created, its owner is the user identity of the client process, and its group is the group of the parent directory (the BSD rule).
268        </p>
269<p>
270                Each client process that accesses HDFS has a two-part identity composed of the <em>user name</em>, and <em>groups list</em>. Whenever HDFS must do a permissions check for a file or directory <span class="codefrag">foo</span> accessed by a client process,
271        </p>
272<ul>
273               
274<li>
275                   If the user name matches the owner of <span class="codefrag">foo</span>, then the owner permissions are tested;
276                </li>
277               
278<li>
279                   Else if the group of <span class="codefrag">foo</span> matches any of member of the groups list, then the group permissions are tested;
280                </li>
281               
282<li>
283                   Otherwise the other permissions of <span class="codefrag">foo</span> are tested.
284                </li>
285       
286</ul>
287<p>
288                If a permissions check fails, the client operation fails.       
289</p>
290</div>
291
292
293<a name="N10065"></a><a name="User+Identity"></a>
294<h2 class="h3">User Identity</h2>
295<div class="section">
296<p>
297In this release of Hadoop the identity of a client process is just whatever the host operating system says it is. For Unix-like systems,
298</p>
299<ul>
300
301<li>
302   The user name is the equivalent of <span class="codefrag">`whoami`</span>;
303</li>
304
305<li>
306   The group list is the equivalent of <span class="codefrag">`bash -c groups`</span>.
307</li>
308
309</ul>
310<p>
311In the future there will be other ways of establishing user identity (think Kerberos, LDAP, and others). There is no expectation that this first method is secure in protecting one user from impersonating another. This user identity mechanism combined with the permissions model allows a cooperative community to share file system resources in an organized fashion.
312</p>
313<p>
314In any case, the user identity mechanism is extrinsic to HDFS itself. There is no provision within HDFS for creating user identities, establishing groups, or processing user credentials.
315</p>
316</div>
317
318
319<a name="N10083"></a><a name="Understanding+the+Implementation"></a>
320<h2 class="h3">Understanding the Implementation</h2>
321<div class="section">
322<p>
323Each file or directory operation passes the full path name to the name node, and the permissions checks are applied along the path for each operation. The client framework will implicitly associate the user identity with the connection to the name node, reducing the need for changes to the existing client API. It has always been the case that when one operation on a file succeeds, the operation might fail when repeated because the file, or some directory on the path, no longer exists. For instance, when the client first begins reading a file, it makes a first request to the name node to discover the location of the first blocks of the file. A second request made to find additional blocks may fail. On the other hand, deleting a file does not revoke access by a client that already knows the blocks of the file. With the addition of permissions, a client's access to a file may be withdrawn between requests. Again, changing permissions does not revoke the access of a client that already knows the file's blocks.
324</p>
325<p>
326The map-reduce framework delegates the user identity by passing strings without special concern for confidentiality. The owner and group of a file or directory are stored as strings; there is no conversion from user and group identity numbers as is conventional in Unix.
327</p>
328<p>
329The permissions features of this release did not require any changes to the behavior of data nodes. Blocks on the data nodes do not have any of the <em>Hadoop</em> ownership or permissions attributes associated with them.
330</p>
331</div>
332     
333
334<a name="N10096"></a><a name="Changes+to+the+File+System+API"></a>
335<h2 class="h3">Changes to the File System API</h2>
336<div class="section">
337<p>
338        All methods that use a path parameter will throw <span class="codefrag">AccessControlException</span> if permission checking fails.
339</p>
340<p>New methods:</p>
341<ul>
342       
343<li>
344               
345<span class="codefrag">public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException;</span>
346       
347</li>
348       
349<li>
350               
351<span class="codefrag">public boolean mkdirs(Path f, FsPermission permission) throws IOException;</span>
352       
353</li>
354       
355<li>
356               
357<span class="codefrag">public void setPermission(Path p, FsPermission permission) throws IOException;</span>
358       
359</li>
360       
361<li>
362               
363<span class="codefrag">public void setOwner(Path p, String username, String groupname) throws IOException;</span>
364       
365</li>
366       
367<li>
368               
369<span class="codefrag">public FileStatus getFileStatus(Path f) throws IOException;</span> will additionally return the user, group and mode associated with the path.
370        </li>
371
372
373</ul>
374<p>
375The mode of a new file or directory is restricted my the <span class="codefrag">umask</span> set as a configuration parameter. When the existing <span class="codefrag">create(path, &hellip;)</span> method (<em>without</em> the permission parameter) is used, the mode of the new file is <span class="codefrag">666&thinsp;&amp;&thinsp;^umask</span>. When the new <span class="codefrag">create(path, </span><em>permission</em><span class="codefrag">, &hellip;)</span> method (<em>with</em> the permission parameter <em>P</em>) is used, the mode of the new file is <span class="codefrag">P&thinsp;&amp;&thinsp;^umask&thinsp;&amp;&thinsp;666</span>. When a new directory is created with the existing <span class="codefrag">mkdirs(path)</span> method (<em>without</em> the permission parameter), the mode of the new directory is <span class="codefrag">777&thinsp;&amp;&thinsp;^umask</span>. When the new <span class="codefrag">mkdirs(path, </span><em>permission</em> <span class="codefrag">)</span> method (<em>with</em> the permission parameter <em>P</em>) is used, the mode of new directory is <span class="codefrag">P&thinsp;&amp;&thinsp;^umask&thinsp;&amp;&thinsp;777</span>.
376</p>
377</div>
378
379     
380
381<a name="N10100"></a><a name="Changes+to+the+Application+Shell"></a>
382<h2 class="h3">Changes to the Application Shell</h2>
383<div class="section">
384<p>New operations:</p>
385<dl>
386       
387<dt>
388<span class="codefrag">chmod [-R]</span> <em>mode file &hellip;</em>
389</dt>
390       
391<dd>
392                Only the owner of a file or the super-user is permitted to change the mode of a file.
393        </dd>
394       
395<dt>
396<span class="codefrag">chgrp [-R]</span> <em>group file &hellip;</em>
397</dt>
398       
399<dd>
400                The user invoking <span class="codefrag">chgrp</span> must belong to the specified group and be the owner of the file, or be the super-user.
401        </dd>
402       
403<dt>
404<span class="codefrag">chown [-R]</span> <em>[owner][:[group]] file &hellip;</em>
405</dt>
406       
407<dd>
408                The owner of a file may only be altered by a super-user.
409        </dd>
410       
411<dt>
412<span class="codefrag">ls </span> <em>file &hellip;</em>
413</dt>
414<dd></dd>
415       
416<dt>
417<span class="codefrag">lsr </span> <em>file &hellip;</em>
418</dt>
419       
420<dd>
421                The output is reformatted to display the owner, group and mode.
422        </dd>
423
424</dl>
425</div>
426
427     
428
429<a name="N1013F"></a><a name="The+Super-User"></a>
430<h2 class="h3">The Super-User</h2>
431<div class="section">
432<p>
433        The super-user is the user with the same identity as name node process itself. Loosely, if you started the name node, then you are the super-user. The super-user can do anything in that permissions checks never fail for the super-user. There is no persistent notion of who <em>was</em> the super-user; when the name node is started the process identity determines who is the super-user <em>for now</em>. The HDFS super-user does not have to be the super-user of the name node host, nor is it necessary that all clusters have the same super-user. Also, an experimenter running HDFS on a personal workstation, conveniently becomes that installation's super-user without any configuration.
434        </p>
435<p>
436        In addition, the administrator my identify a distinguished group using a configuration parameter. If set, members of this group are also super-users.
437</p>
438</div>
439
440
441<a name="N10152"></a><a name="The+Web+Server"></a>
442<h2 class="h3">The Web Server</h2>
443<div class="section">
444<p>
445The identity of the web server is a configuration parameter. That is, the name node has no notion of the identity of the <em>real</em> user, but the web server behaves as if it has the identity (user and groups) of a user chosen by the administrator. Unless the chosen identity matches the super-user, parts of the name space may be invisible to the web server.</p>
446</div>
447
448
449<a name="N1015F"></a><a name="On-line+Upgrade"></a>
450<h2 class="h3">On-line Upgrade</h2>
451<div class="section">
452<p>
453If a cluster starts with a version 0.15 data set (<span class="codefrag">fsimage</span>), all files and directories will have owner <em>O</em>, group <em>G</em>, and mode <em>M</em>, where <em>O</em> and <em>G</em> are the user and group identity of the super-user, and <em>M</em> is a configuration parameter. </p>
454</div>
455
456
457<a name="N1017E"></a><a name="Configuration+Parameters"></a>
458<h2 class="h3">Configuration Parameters</h2>
459<div class="section">
460<dl>
461       
462<dt>
463<span class="codefrag">dfs.permissions = true </span>
464</dt>
465       
466<dd>
467                If <span class="codefrag">yes</span> use the permissions system as described here. If <span class="codefrag">no</span>, permission <em>checking</em> is turned off, but all other behavior is unchanged. Switching from one parameter value to the other does not change the mode, owner or group of files or directories.
468                <p>
469               
470</p>
471                Regardless of whether permissions are on or off, <span class="codefrag">chmod</span>, <span class="codefrag">chgrp</span> and <span class="codefrag">chown</span> <em>always</em> check permissions. These functions are only useful in the permissions context, and so there is no backwards compatibility issue. Furthermore, this allows administrators to reliably set owners and permissions in advance of turning on regular permissions checking.
472        </dd>
473       
474<dt>
475<span class="codefrag">dfs.web.ugi = webuser,webgroup</span>
476</dt>
477       
478<dd>
479                The user name to be used by the web server. Setting this to the name of the super-user allows any web client to see everything. Changing this to an otherwise unused identity allows web clients to see only those things visible using "other" permissions. Additional groups may be added to the comma-separated list.
480        </dd>
481       
482<dt>
483<span class="codefrag">dfs.permissions.supergroup = supergroup</span>
484</dt>
485       
486<dd>
487                The name of the group of super-users.
488        </dd>
489       
490<dt>
491<span class="codefrag">dfs.upgrade.permission = 777</span>
492</dt>
493       
494<dd>
495                The choice of initial mode during upgrade. The <em>x</em> permission is <em>never</em> set for files. For configuration files, the decimal value <em>511<sub>10</sub></em> may be used.
496        </dd>
497       
498<dt>
499<span class="codefrag">dfs.umask = 022</span>
500</dt>
501       
502<dd>
503                The <span class="codefrag">umask</span> used when creating files and directories. For configuration files, the decimal value <em>18<sub>10</sub></em> may be used.
504        </dd>
505
506</dl>
507</div>
508
509     
510 
511</div>
512<!--+
513    |end content
514    +-->
515<div class="clearboth">&nbsp;</div>
516</div>
517<div id="footer">
518<!--+
519    |start bottomstrip
520    +-->
521<div class="lastmodified">
522<script type="text/javascript"><!--
523document.write("Last Published: " + document.lastModified);
524//  --></script>
525</div>
526<div class="copyright">
527        Copyright &copy;
528         2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
529</div>
530<!--+
531    |end bottomstrip
532    +-->
533</div>
534</body>
535</html>
Note: See TracBrowser for help on using the repository browser.