CentOS掛載windows共用資料夾

來源:互聯網
上載者:User

標籤:centos linux

伺服器使用的是CentOS系統,而本機使用的win7系統。考慮到是臨時使用,所以就不打算搭建FTP和Samba伺服器,直接通過CentOS掛載windows共用資料夾的方式來達到此目的。

既然是使用windows共用資料夾的方式,那麼我們必須先在本機建立一個共用目錄。如下:

650) this.width=650;" title="clip_image001" border="0" alt="clip_image001" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409705Apk9.png" width="573" height="465" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

650) this.width=650;" title="clip_image002" border="0" alt="clip_image002" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409705f9QC.png" width="649" height="513" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

在此需要注意下,我們給administrator管理員的共用許可權是可讀寫權限。等下我們會在CentOS系統中進行測試該許可權。

650) this.width=650;" title="clip_image003" border="0" alt="clip_image003" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409706VJF5.png" width="628" height="498" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

共用資料夾配置完成後,我們現在其他機器上訪問此共用看看是否可以成功。如下:

\\192.168.1.126

650) this.width=650;" title="clip_image004" border="0" alt="clip_image004" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409706ac58.png" width="668" height="523" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

通過我們可以看出,此共用已經可以被正常訪問。

現在我們在CentOS上進行掛載,使用如下命令:

mount -t cifs -o username=administrator,[email protected] //192.168.1.126/789 /share/

650) this.width=650;" title="clip_image005" border="0" alt="clip_image005" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409707D7Rz.png" width="901" height="375" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

通過我們可以看出,此共用資料夾已經成功的在伺服器上進行掛載。

該命令中的cifs表示的微軟的cifs協議。

如果要使CentOS開機啟動後自動掛載該共用,可以編輯/etc/fstab檔案,加入以下命令:

//192.168.1.126/789 /iso cifs auto, username=administrator,[email protected] 0 0

或者使用如下命令也可以:

echo "//192.168.1.126/789 /share cifs auto,username=administrator,[email protected] 0 0">> /etc/fstab

650) this.width=650;" title="clip_image006" border="0" alt="clip_image006" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409708Aall.png" width="1096" height="316" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

取消掛載,使用如下命令:

umount /iso

650) this.width=650;" title="clip_image007" border="0" alt="clip_image007" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409708JlJ2.png" width="510" height="171" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;padding-right:0px;" />

以上我講解的windows共用資料夾的掛載與卸載,下面我們來測試共用資料夾的許可權。

注意上述命令中,我們掛載該共用使用的是administrator使用者,前文我們已經提到過administrator使用者對該共用資料夾具有讀寫權限。

現在我們建立一個目錄和檔案看下,如下:

mkdir /share/testdir

touch /share/testfile.sh

650) this.width=650;" title="clip_image008" border="0" alt="clip_image008" src="http://blog.chinaunix.net/attachment/201409/11/21710354_14104097097tN7.png" width="901" height="243" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;" />

650) this.width=650;" title="clip_image009" border="0" alt="clip_image009" src="http://blog.chinaunix.net/attachment/201409/11/21710354_1410409709utaO.png" width="996" height="258" style="border:0px;background-image:none;padding-top:0px;padding-left:0px;padding-right:0px;" />

通過以上兩張,我們發現許可權確實和我們之前給共用資料夾的一樣,具有可讀寫權限。

到此有關CentOS掛載windows共用資料夾的內容介紹完畢。


CentOS掛載windows共用資料夾

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.