使用 fstab 自動掛載外部硬碟並授予其所有讀寫權限

使用 fstab 自動掛載外部硬碟並授予其所有讀寫權限

這是這筆交易:

我已經使用我的硬碟有一段時間了,最近我使用 fstab 將其自動安裝在/media/kevin/toshiba.

現在,無論何時安裝它,其權限都會變為drwxrwxrwx。將硬碟插到另一台電腦上顯示預設權限,顯然不是上面的。

如何在保留預設權限的情況下掛載 h。

編輯1:

這是我的/etc/fstab條目:

# <file system>         <mount point>               <type>  <options>     <dump> <pass>
UUID=8C3669123668FE98   /media/kevin/kevin-toshiba  ntfs    defaults        0       0 

我也嘗試過這個:

# <file system>         <mount point>              <type>  <options>                             <dump> <pass>
UUID=8C3669123668FE98   /media/kevin/kevin-toshiba  ntfs   nls=iso8859-1,permissions,users,auto    0     0

答案1

我發現自動掛載驅動器的一種更簡單的方法是將掛載命令放入 /etc/rc.local 中。我在使用 fstab 時遇到了各種各樣的麻煩,所以這就是我現在所做的。 /etc/rc.local 是一個 bash 腳本,在啟動時由 root 執行。只需建立要安裝磁碟機的資料夾,然後將安裝命令新增至 /etc/rc.local 中「exit」行上方的任何位置,然後重新啟動。

這是我的樣子。

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#Mounts Storage
mount /dev/sdb1 /mnt/Storage

exit 0

相關內容