forked from docs/doc-exports
Reviewed-by: Muller, Martin <martin.muller@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
47 lines
7.0 KiB
HTML
47 lines
7.0 KiB
HTML
<a name="sfs_01_0100"></a><a name="sfs_01_0100"></a>
|
|
|
|
<h1 class="topictitle1">Mounting a File System to a Linux ECS as a Non-root User</h1>
|
|
<div id="body1550126534609"><div class="section" id="sfs_01_0100__section15512154184412"><h4 class="sectiontitle">Scenarios</h4><p id="sfs_01_0100__p1912322155117">By default, a Linux ECS allows only the <strong id="sfs_01_0100__b695718159484">root</strong> user to run the <strong id="sfs_01_0100__b202391386132">mount</strong> command for mounting a file system. However, if the permissions of user <strong id="sfs_01_0100__b995119314482">root</strong> are assigned to other common users, such users can also run the <strong id="sfs_01_0100__b2851151412136">mount</strong> command for file system mounting. The following describes how to mount a file system to a Linux ECS as a common user. The EulerOS is used as an example.</p>
|
|
</div>
|
|
<div class="section" id="sfs_01_0100__section1689695774314"><h4 class="sectiontitle">Prerequisites</h4><ul id="sfs_01_0100__ul22392394151035"><li id="sfs_01_0100__li1643177211639">A non-<strong id="sfs_01_0100__b114466933413">root</strong> user has been created on the ECS.</li><li id="sfs_01_0100__li2654923983">A file system has been created and can be mounted to the ECS by the <strong id="sfs_01_0100__b4917115853319">root</strong> user.</li><li id="sfs_01_0100__li36708344151035">You have obtained the mount point of the file system.</li></ul>
|
|
</div>
|
|
<div class="section" id="sfs_01_0100__section72201550134310"><h4 class="sectiontitle">Procedure</h4><ol id="sfs_01_0100__ol342917472027"><li id="sfs_01_0100__li64303476214"><span>Log in to the ECS as user <strong id="sfs_01_0100__b825913931614">root</strong>.</span></li><li id="sfs_01_0100__li8653182515501"><span>Assign the permissions of user <strong id="sfs_01_0100__b141941718507">root</strong> to the non-<strong id="sfs_01_0100__b3636115195017">root</strong> user.</span><p><ol type="a" id="sfs_01_0100__ol17713949195013"><li id="sfs_01_0100__li18357757134711">Run the <strong id="sfs_01_0100__b1531193551612">chmod 777 /etc/sudoers</strong> command to change the <strong id="sfs_01_0100__b03437337178">sudoers</strong> file to be editable.</li><li id="sfs_01_0100__li1631735511536">Use the <strong id="sfs_01_0100__b057910175411">which</strong> command to view the <strong id="sfs_01_0100__b16352193017318">mount</strong> and <strong id="sfs_01_0100__b63511165517">umount</strong> command paths.<div class="fignone" id="sfs_01_0100__fig71849563558"><span class="figcap"><b>Figure 1 </b>Viewing command paths</span><br><span><img id="sfs_01_0100__image111845567557" src="en-us_image_0000001516236436.png"></span></div>
|
|
</li><li id="sfs_01_0100__li715217349512">Run the <strong id="sfs_01_0100__b18140232181594">vi /etc/resolv.conf</strong> command to edit the <strong id="sfs_01_0100__b84235270615915">sudoers</strong> file.</li><li id="sfs_01_0100__li17841124135610">Add a common user under the <strong id="sfs_01_0100__b1016110252502">root</strong> account. In the following figure, user <strong id="sfs_01_0100__b85521853131716">Mike</strong> is added.<div class="fignone" id="sfs_01_0100__fig1615624682112"><span class="figcap"><b>Figure 2 </b>Adding a user</span><br><span><img id="sfs_01_0100__image915610461212" src="en-us_image_0000001516396416.png"></span></div>
|
|
</li><li id="sfs_01_0100__li1491173310216">Press <strong id="sfs_01_0100__b51116037112652">Esc</strong>, input <strong id="sfs_01_0100__b58164000112657">:wq</strong>, and press <strong id="sfs_01_0100__b6357507311271">Enter</strong> to save and exit.</li><li id="sfs_01_0100__li379729692">Run the <strong id="sfs_01_0100__b1179445451819">chmod 440 /etc/sudoers</strong> command to change the <strong id="sfs_01_0100__b107981154101818">sudoers</strong> file to be read-only.</li></ol>
|
|
</p></li><li id="sfs_01_0100__li11734435318"><span>Log in to the ECS as user <strong id="sfs_01_0100__b13711123291915">Mike</strong>.</span></li><li id="sfs_01_0100__li340192251118"><span>Run the following command to mount the file system. For details about the mounting parameters, see <a href="#sfs_01_0100__table0741121164416">Table 1</a>.</span><p><p id="sfs_01_0100__p55415361311"><strong id="sfs_01_0100__b19826210105517">sudo mount -t nfs -o vers=3,timeo=600,noresvport,nolock</strong> <i><span class="varname" id="sfs_01_0100__varname8893193665014">Mount point</span></i> <i><span class="varname" id="sfs_01_0100__varname889483665017">Local path</span></i></p>
|
|
|
|
<div class="tablenoborder"><a name="sfs_01_0100__table0741121164416"></a><a name="table0741121164416"></a><table cellpadding="4" cellspacing="0" summary="" id="sfs_01_0100__table0741121164416" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="sfs_01_0100__row97431121124411"><th align="left" class="cellrowborder" valign="top" width="17.080000000000002%" id="mcps1.3.3.2.4.2.2.2.3.1.1"><p id="sfs_01_0100__p188663294473">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="82.92%" id="mcps1.3.3.2.4.2.2.2.3.1.2"><p id="sfs_01_0100__p186592974715">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="sfs_01_0100__row074372114417"><td class="cellrowborder" valign="top" width="17.080000000000002%" headers="mcps1.3.3.2.4.2.2.2.3.1.1 "><p id="sfs_01_0100__p13301182412477"><em id="sfs_01_0100__i089293125117">Mount point</em></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="82.92%" headers="mcps1.3.3.2.4.2.2.2.3.1.2 "><p id="sfs_01_0100__p173036243476"></p>
|
|
<div class="note" id="sfs_01_0100__note1931112414478"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="sfs_01_0100__p12312112413478"><em id="sfs_01_0100__i842352697163853">x</em> is a digit or letter.</p>
|
|
<p id="sfs_01_0100__p203122243478">If the mount point is too long to display completely, you can adjust the column width.</p>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
<tr id="sfs_01_0100__row125621115134717"><td class="cellrowborder" valign="top" width="17.080000000000002%" headers="mcps1.3.3.2.4.2.2.2.3.1.1 "><p id="sfs_01_0100__p1118632112125"><em id="sfs_01_0100__i47931287519">Local path</em></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="82.92%" headers="mcps1.3.3.2.4.2.2.2.3.1.2 "><p id="sfs_01_0100__p10186182112124">Local path on the ECS, used to mount the file system, for example, <span class="filepath" id="sfs_01_0100__filepath56690752116"><b>/local_path</b></span>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</p></li><li id="sfs_01_0100__li5710615156"><span>Run the following command to view the mounted file system:</span><p><p id="sfs_01_0100__p47116191517"><strong id="sfs_01_0100__b137126161513">mount -l</strong></p>
|
|
<div class="p" id="sfs_01_0100__p16724681520">If the command output contains the following information, the file system has been mounted.<pre class="screen" id="sfs_01_0100__screen172768152">example.com:/share-xxx on /local_path type nfs (rw,vers=3,timeo=600,nolock,addr=)</pre>
|
|
</div>
|
|
</p></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="sfs_01_0098.html">Other Operations</a></div>
|
|
</div>
|
|
</div>
|
|
|