掛載 USB 隨身碟 -- 除非有 su 權限否則無法刪除文件

掛載 USB 隨身碟 -- 除非有 su 權限否則無法刪除文件

有沒有辦法可以自動掛載此 USB 驅動器,這樣我就不需要 root 權限來刪除檔案?

這是我的 fstab 檔案中目前的內容:

/dev/sdb1 /mnt/epson auto defaults,user,exec,umask=777 0 0

當我嘗試刪除資料/mnt/epson夾中的文件時:

$:/mnt/epson/EPSCAN/001$ rm EPSON004.PDF
rm: remove write-protected regular file ‘EPSON004.PDF’? y
rm: cannot remove ‘EPSON004.PDF’: Permission denied

如果我以 sudo 身份運行,我可以刪除該檔案。我想授權任何用戶刪除 USB 驅動器上的文件,因為它是插入 Epson WorkForce 840 印表機的 USB 記憶棒,並且我正在透過此安裝的驅動器共享掃描結果。我的備份解決方案是安排一個計時作業定期清除資料夾,但我想允許使用者刪除這些檔案。

資料夾中的任何操作也是如此,我也無法更改所有權:

/mnt$ sudo chown user:user -R epson
chown: changing ownership of ‘epson/EPSCAN/001/test’: Operation not permitted
chown: changing ownership of ‘epson/EPSCAN/001/EPSON004.PDF’: Operation not permitted
chown: changing ownership of ‘epson/EPSCAN/001/EPSON005.PDF’: Operation not permitted
chown: changing ownership of ‘epson/EPSCAN/001/EPSON006.PDF’: Operation not permitted
chown: changing ownership of ‘epson/EPSCAN/001’: Operation not permitted
chown: changing ownership of ‘epson/EPSCAN’: Operation not permitted
chown: changing ownership of ‘epson’: Operation not permitted

編輯:

問題解決了:

問題解決了,這是我的 fstab 檔案:

/dev/sdb1 /mnt/epson vfat user,umask=0000,iocharset=utf8 0 0

http://ubuntuforums.org/showthread.php?t=1156286

答案1

你的問題在這裡:

/dev/sdb1 /mnt/epson auto defaults,user,exec,umask=777 0 0

這僅意味著用戶能夠掛載(事實上,root 始終能夠掛載,因此您無需更改任何內容),但您要尋找的是user_id=0,group_id=0,default_permissions.

將其添加到您的 fstab 行中,透過我更喜歡更完整的內容:

/dev/sdb1 /mnt/epson auto defaults,user,exec,umask=777,rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other 0 0

額外的是allow_other,允許實際安裝的使用者以外的其他使用者存取已安裝的檔案系統。

相關內容