Linux大数据开发基础:第三节:用户和组

转载 2016年01月03日 18:44:09

http://blog.csdn.net/lovehuangjiaju/article/details/47904673

本节主要内容

  1. 理解用户和组的概念
  2. 用户管理
  3. 组管理
  4. 权限分配

1. 理解用户和组的概念

在第一讲中我们提到,linux是一种多任务、多用户的操作系统,在讲ls -l命令行我们看到如下文件详细信息:

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">ls</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">l</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">total</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Desktop</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Documents</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Downloads</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">179</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">21:53</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">examples</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">desktop</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">30</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:28</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:29</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: bopder-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">16:51</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">literature</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Music</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Pictures</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">15:52</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Public</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Templates</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Videos</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li></ul>

这其中便涉及到用户和组的权限问题,在讲这部分内容之前呢,先来理解一下用户和组的概念

在Linux中,用户是能够获取系统资源的权限的集合,组是权限的容器。

Linux用户类型

部分内容来源于:http://www.2cto.com/os/201404/293172.html

用户类型 描述
管理员 root 具有使用系统所有权限的用户,其UID 为0
普通用户 即一般用户,其使用系统的权限受限,其UID为500-60000之间.
系统用户 保障系统运行的用户,一般不提供密码登录系统,其UID为1-499之间

与Linux用户信息相关的文件有两个,分别是/etc/passwd, /etc/shadow 
/etc/passwd文件内容如下:

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/xtwy</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># more /etc/passwd</span>
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">root:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:root</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/root</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/bin/bash</span>
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">bin:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:bin</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/bin</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/bin/sh</span>
........................
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">xtwy:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:Ubuntu-</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10.04</span>,,,<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/xtwy</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/bin/bash</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

/etc/passwd文件内容格式为:

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">account:password:<span class="hljs-constant" style="box-sizing: border-box;">UID</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:GID</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:GECOS</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:diretory</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:shell</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

account: 用户名或帐号 
password :用户密码占位符 
UID:用户的ID号 
GID:用户所在组的ID号 
GECOS:用户的详细信息(如姓名,年龄,电话等) 
diretory:用户所的主目录 
shell:用户所在的编程环境

/etc/shadow文件内容格式为:

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root:$1$</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">TZS2yur$uQ3</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">5XLbdEhLkak9HKqZx/:16042:0:99999:7:空白:空白:空白</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">5</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">6</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">7</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">8</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">9</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">保留字段,目前为空</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">用户过期日期(单位/天),此字段指定了用户作废的天数(从1970年的1月1日至今天数)</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">在口令过期之后多少天禁用此用户</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">提前多少天警告用户口令将过期</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">两次修改口令间隔最多的天数</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">两次修改口令间隔最少的天数</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>                            <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">上次修改密码的时间(单位/天),自1970年01月01日至今天数</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>           <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">用户密码(对应/etc/passwd文件内的密码占位符),如果密码添加“!!”表示禁用该用户</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">用户名(对应/etc/passwd文件内的用户名)</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">注:其中字段4、5、6、7、8的值为空时,账号可永久使用</span>

</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li></ul>

Linux用户组类型

用户组类型 描述
普通用户组 可以加入多个用户
系统组 一般加入一些系统用户
私有组(也称基本组) 当创建用户时,如果没有为其指明所属组,则就为其定义一个私有的用户组,起名称与用户名同名,当把其他用户加入到该组中,则其就变成了普通组

前面我提到,组是权限的容器,如普通用户 user1,user2, user3所属组group,则它们会继承组group的权限,与group相关的文件包括/etc/group /etc/gshadow

下面给出的是/etc/group文件内容及格式含义

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root:x:0:root</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">额外组(可以多个用“</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">,</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">”隔开)</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">组ID(GID)</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">组密码占位符</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">组名</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li></ul>

下面给出的是/etc/gshadow文件内容及格式含义

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root:空白:空白:root</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">以逗号分隔的小组成员</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">以逗号分隔的组管理员</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span>    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">加密的密码</span>
 <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">|</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">组名</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

2. 用户管理

Linux中的用户管理主要涉及到用户账号的添加、删除和修改。所有操作都影响/etc/passwd中的文件内容

(1)添加用户 useradd

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">useradd [options] username
options:
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>.-u :<span class="hljs-constant" style="box-sizing: border-box;">UID</span>
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span>.-g :<span class="hljs-constant" style="box-sizing: border-box;">GID</span>
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3</span>.-d :指定用户家目录,默认是/home/username
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4</span>.-s :指定用户所在的shell环境
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">5</span>.-<span class="hljs-constant" style="box-sizing: border-box;">G</span>:指定用户的附加组

例子:
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/xtwy</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># useradd -u 1988 -g 1000 john</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/xtwy</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># tail -1 /etc/passwd</span>
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">john:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1988</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/john</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/bin/sh</span>
添加完成后可以采用下列命令进行用户john密码的修改
xtwy<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:~</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>sudo passwd john
[sudo] password <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">for</span> <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">xtwy:</span> 
<span class="hljs-constant" style="box-sizing: border-box;">Enter</span> new <span class="hljs-constant" style="box-sizing: border-box;">UNIX</span> <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">password:</span> 
<span class="hljs-constant" style="box-sizing: border-box;">Retype</span> new <span class="hljs-constant" style="box-sizing: border-box;">UNIX</span> <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">password:</span> 
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">passwd:</span> password updated successfully
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li></ul>

注销用户,重新到登录界面时,便会出现john用户的登录选项 
这里写图片描述

(2)修改用户 usermod

<code class="hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">usermod  [options] username
options:
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>.-u :UID
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span>.-g :GID
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3</span>.<span class="hljs-operator" style="box-sizing: border-box;">-d</span> :指定用户家目录,默认是/home/username
            -m 与-b 一起用表示把用户家目录的内容也移走
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4</span>.<span class="hljs-operator" style="box-sizing: border-box;">-s</span> :指定用户所在的shell环境
    <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">5</span>.-G:指定用户的附加组
 使用示例:
 //将前面的/bin/sh,改/bin/bash
 root@ubuntu:/home/john<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># usermod -s /bin/bash john</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li></ul>

(3)删除用户 userdel

删除用户时,用户不能处于登录状态:

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">userdel   [options]username
 options
 <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>.-r :连同主目录一起删除

使用示例:
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/xtwy</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># userdel -r john</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home/xtwy</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># cd ..</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># ls</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>

3. 组管理

前面我们知道,组是权限的集合。在linux系统中,每个用户都有一个用户组,没有指定时都默认为私有组,私有组名同用户名一致,建立用户组的好处是系统能对一个用户组中的所有用户的操作权限进行集中管理。组管理涉及组的添加、删除和修改。组的增加、删除和修改实际上就对/etc/group文件的更新。

(1)新增用户组

<code class="hljs mel has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">groupadd [options] 用户组名
options:
 <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> -g GID:指定新用户组的组标识号(GID)。

使用示例:
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//创建用户组前的/etc/group文件内容</span>
oot<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span>:/home# tail /etc/<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">group</span>
.....................
xtwy:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span>:
sambashare:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">122</span>:xtwy
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//使用默认增加用户组</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span>:/home# groupadd john
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//添加用户组后得到的/etc/group文件内容</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//可以看到默认用户组gid是自增长的</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span>:/home# tail /etc/<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">group</span>
.................
xtwy:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span>:
sambashare:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">122</span>:xtwy
john:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1001</span>:
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//指定gid</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span>:/home# groupadd -g <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1011</span> john1
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span>:/home# tail /etc/<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">group</span>
................
john:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1001</span>:
john1:x:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1011</span>:
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li></ul>

(2)修改用户组

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">groupmod [options] 用户组名
options:
 <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> -g <span class="hljs-constant" style="box-sizing: border-box;">GID</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span> 为用户组指定新的组标识号。
 <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span> -n <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span> 将用户组的名字改为新名字

使用示例:
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># groupmod -g 1002 -n john2 john1</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># tail /etc/group</span>
.....................
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">john:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1001</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span>
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">john2:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1002</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li></ul>

(3)删除用户组

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">groupdel 用户组名

使用示例:
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># groupdel john2</span>
root<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">@ubuntu</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:/home</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># tail /etc/group</span>
....................
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">xtwy:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span>
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">sambashare:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">122</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:xtwy</span>
<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">john:</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">x:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1001</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li></ul>

4. 权限分配 ##

(1)权限说明

在本节第一节,我们提到ls -l命令显示的文件或目录详细信息具有如下格式

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">ls</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">l</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">total</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Desktop</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Documents</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Downloads</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">179</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">21:53</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">examples</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">desktop</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">30</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:28</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:29</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">16:51</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">literature</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>

现在我们对ls -l显示的内容进行分解,首先来看前半部分 
这里写图片描述 
首先是文件类型,-表示文本文件,d表示目录,除此之外还有下列几种文件(不常见):

code File Type
- Standard file
d Standard directory
l Symbolic link (a shortcut to another file)
s Socket (a file designed to send and receive data over a network)
c Character device (a hardware device driver, usually found in /dev)
b Block device (a hardware device driver, usually found in /dev)

后面紧跟着的是用户权限、组权限及其它权限,其中r表示读权限,w表示写权限,x表示可执行权限,

再后面的数字表示的是链接数,这个放到下一节中介绍 
紧接着是文件或目录的所属者,所属用户组,文件大小(字节数),文件最后访问时间,文件名。

下面具体说明:

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">//hello1<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>是一个普通文件
//root用户具有读写权限,但不能执行
//用户组root具有读权限,无写和执行权限
//其它用户只有读权限,无写和执行权限
-rw-r--r-- <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> root root   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">30</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2015</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">08</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">22</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">17</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">28</span> hello1<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>

//下面的代码演示了前面的内容
xtwy@ubuntu:~$ ls
Desktop    Downloads         hello1<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>  literature  Pictures  Templates
Documents  examples<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.desktop</span>  hello<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>   Music       Public    Videos
xtwy@ubuntu:~$ more hello1<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>
hello linux
hello linux linux
xtwy@ubuntu:~$ echo <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"test permission"</span> >> hello1<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>
<span class="hljs-label" style="box-sizing: border-box;">bash:</span> hello1<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.txt</span>: Permission denied
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li></ul>
<code class="hljs lasso has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//Desktop是一个目录</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//用户xtwy具有读写和执行权限,这里面的执行权限x表示可以访问目录</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//用用组xtwy具有读和执行权限,无写权限</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//其它用户具有读和执行权限,无写权限</span>
drwxr<span class="hljs-attribute" style="box-sizing: border-box;">-xr</span><span class="hljs-attribute" style="box-sizing: border-box;">-x</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span> xtwy xtwy <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4096</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2015</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">-</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">08</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">-</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">20</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">23</span>:<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">31</span> Desktop</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

(2)修改文件或目录权限

1 增加权限

<code class="hljs haml has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//chmod命令,a表示所有,包括用户、组及其它用户都有增加写权限</span>
root@ubuntu:/home/xtwy# chmod a+w hello1.txt
root@ubuntu:/home/xtwy# ls -l
total 48
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Desktop
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Documents
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Downloads
-<span class="ruby" style="box-sizing: border-box;">rw-r--r-- <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> xtwy xtwy  <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">179</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2015</span>-08-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">20</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">21</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">53</span> examples.desktop
</span>-<span class="ruby" style="box-sizing: border-box;">rw-rw-rw- <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> root root   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">30</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2015</span>-08-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">22</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">17</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">28</span> hello1.txt
</span>-<span class="ruby" style="box-sizing: border-box;">rw-r--r-- <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> root root   <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">48</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2015</span>-08-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">22</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">17</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">29</span> hello.txt
</span>drwxr-xr-x 3 root root 4096 2015-08-22 16:51 literature
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Music
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Pictures
drwxr-xr-x 3 xtwy xtwy 4096 2015-08-22 15:52 Public
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Templates
drwxr-xr-x 2 xtwy xtwy 4096 2015-08-20 23:31 Videos
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li></ul>

2 减小权限

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//减小权限,用减号表示</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">chmod</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">a</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">w</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">ls</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">l</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">total</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Desktop</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Documents</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Downloads</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">179</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">21:53</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">examples</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">desktop</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">30</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:28</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:29</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">16:51</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">literature</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Music</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Pictures</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">15:52</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Public</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Templates</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Videos</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li></ul>

3 给当前用户增加权限

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//不加all表示作用于当前用户</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">chmod</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">+</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">w</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">ls</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">l</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">total</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Desktop</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Documents</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Downloads</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">179</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">21:53</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">examples</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">desktop</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">30</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:28</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:29</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">16:51</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">literature</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Music</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Pictures</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">15:52</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Public</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style=color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Templates</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Videos</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li></ul>

4 灵活设置权限,采用数字方式

读、写、运行三项权限可以用数字表示,就是r=4,w=2,x=1

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//用户具有读写权限</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//用户组和其它用户具有执行权限,无读写权限</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">chmod</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">611</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root@ubuntu:/home/xtwy#</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">ls</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">l</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">total</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Desktop</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Documents</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Downloads</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span>  <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">179</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">21:53</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">examples</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">desktop</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">30</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:28</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">r</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">48</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:29</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">16:51</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">literature</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Music</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Pictures</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">3</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">15:52</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Public</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Templates</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">drwxr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xr</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">4096</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">20</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:31</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">Videos</span>
</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li></ul>

5 改变用户 chown

将root拥有改xtwy用户拥有

<code class="hljs livecodeserver has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">-rw<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">---x--x 1 root root   30 2015-08-22 17:28 hello1.txt</span>
root@ubuntu:/home/xtwy<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># chown xtwy hello1.txt</span>
-rw<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">---x--x 1 xtwy root   30 2015-08-22 17:28 hello1.txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">
//修改完成后可以对文件中的内容进行修改</span>
root@ubuntu:/home/xtwy<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;"># su xtwy</span>
xtwy@ubuntu:~$ echo <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"test permissions"</span> >> hello1.txt

</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li></ul>

6 改变用户组 chgrp

<code class="hljs brainfuck has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">root</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">30</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">17:28</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy@ubuntu:~$</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">chgrp</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span>
<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">rw</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">x</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">1</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">xtwy</span>   <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">47</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">2015</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">08</span><span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">-</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">22</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">23:43</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">hello1</span><span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">.</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">txt</span></code>

相关文章推荐

Spark修炼之道(基础篇)——Linux大数据开发基础:第三节:用户和组

本节主要内容 理解用户和组的概念 用户管理 组管理 权限分配 1. 理解用户和组的概念在第一讲中我们提到,linux是一种多任务、多用户的操作系统,在讲ls -l命令行我们看到如下文件详细信息:roo...

Spark修炼之道(基础篇)——Linux大数据开发基础:第十三节:Shell编程入门(五)

本节主要内容 while循环控制结构 if条件判断 until循环控制结构1. while循环控制结构本节例子来源:http://blog.chinaunix.net/uid-25880122-id-...

【企业报表数据读取与传递】【第三节】报表数据展示弹出框开发

弹出框界面: 1. 读取企业报表计算结果  1.1 创建上下文 private UfoContextVO createContext(RepDataQueryResultVO vo) ...

数据结构第三节作业

  • 2015年05月22日 20:11
  • 279KB
  • 下载

MINA2.0用户手册中文版--第三章 第三节 服务端接口IoAcceptor

要构建一个服务端,你必须选择一个IoAcceptor接口的实现类。 接口IoAcceptor 基本上来说,该接口的命名是由于accpet()方法,它主要负责在一个客户端和该服务...

Machine Learning on Spark——第三节 统计基础(一)

作者:周志湖 微信号:zhouzhihubeyond本文主要内容本文对了org.apache.spark.mllib.stat包及子包中的相关统计类进行介绍,stat包中包括下图中的类或对象: ...

学习javascript基础知识系列第三节 - ()()用法

总目录: 通过一段代码学习javascript基础知识系列 注意: 为了便于执行和演示,建议使用chrome浏览器,按F12,然后按Esc(或手动选择)打开console,在cons...
  • isea533
  • isea533
  • 2013年08月25日 13:13
  • 1592

SQL语句 第三节:排序检索数据

第三节:排序检索数据 3.1 单个列的排序 上面一章说了检索数据,也提了一下排序检索数据,我们需要他们的灵活是使用,来完成我们需求,包括后面的条件,连表查询等。 ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Linux大数据开发基础:第三节:用户和组
举报原因:
原因补充:

(最多只允许输入30个字)