Linux下新增Windows磁碟對映

2021-07-09 18:36:21 字數 1684 閱讀 8663

兩台windows機器下要共享檔案,可以很方便的通過對映網路驅動器實現。那麼,linux下怎麼像讀硬碟一樣讀取另一台windows機器的網路對映呢?

其實,只需要幾條命令就可以了~

首先,需要windows進行網路對映。將windows的乙個資料夾共享即可(共享-高階共享,輸入乙個共享名即可)

然後,在linux下安裝一些小的功能:

sudo apt-get install mount

sudo apt-get install smbfs

sudo apt-get install samba

方法/步驟

mount -t cifc "windows共享資料夾" "linux /mnt路徑"

i.e. mount -t cifs /mnt/

linux 會要求輸入訪問windows 共享資料夾上的密碼。

注意:unable to find suitable address.

說明遠端共享資料夾路徑不存在。請仔細檢查,並更正目錄路徑。

mount -t cifc "windows共享資料夾" "linux /mnt路徑"

i.e. mount -t cifs /mnt/

注意:mount error(13): permission denied

refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

解決方案:將訪問windows共享目錄的使用者名稱和密碼直接加入到命令中。

mount -t cifs -o username=windowslogin,password="passwordinwindows"

/mnt/

注意:該命令中,username為windows上的使用者;password為window使用者對應的密碼

步驟3的命令也可以使用以下方式實現:

mount.cifs -o username="administrator",password="passwordforwindows" /mnt/

通過步驟3和步驟4可以成功將windows共享資料夾掛載在/mnt目錄下。不過由於mount命令只能由root許可權使用者使用。其掛載資料夾的預設owner和group都為root,並且不能通過chmod命令更改許可權。

使用mount命令,給掛載共享資料夾指定owner和group.

mount.cifs -o username="administrator",password="passwordforwindows",uid=mysa,gid=mysa /mnt/

檢查/mnt/中資料夾的owner和group。

更改資料夾許可權。給mount共享資料夾所在組的寫許可權。

mount.cifs -o username="administrator",password="passwordforwindows",mysa,gid=mysa,dir_mode=0777 /mnt/

如果每次開機就希望該分割槽已經載入了,那麼可以執行如下的步驟:

sudo gedit /etc/fstab

在檔案末尾新增一行:

/home/user/folder1 cifs defaults,auto,username=user,password=***

其中username和password就是linux的使用者名稱密碼

然後重啟或者輸入sudo mount -a即可~

windows下新增路由

1.首先在 執行 視窗輸入cmd 按win r開啟執行視窗 然後回車進入命令列。2.在命令列下輸入route命令,會有對應的提示資訊。route f p 4 6 command destination mask netmask gateway metric metric if inte ce f 清...

windows下新增gitlab ssh公鑰

git 1.9.5 preview20141217 1.安裝git,從程式目錄開啟 git bash 2.鍵入命令 ssh keygen t rsa c email email.com email email.com 是gitlab賬號 3.提醒你輸入key的名稱,輸入如id rsa 4.在程式目錄...

Windows下Apache新增SSL模組

參考資料 測試環境 windows2003 32位 apache2.4 php5.4 首先cmd命令進入 bin目錄下 1 成 伺服器公鑰檔案server.key openssl genrsa out server.key 1024 2 生成server.csr openssl req new ou...