无法从安装的磁盘 (Ubuntu 18.04) 执行 .sh 脚本:zsh:权限被拒绝

Can't execute a .sh script from mounted disk (Ubuntu 18.04): zsh: permission denied

Ubuntu 18.04 - 从 here.

安装 Zsh 和 Oh-My-Zsh

鉴于以下情况

echo '#!/bin/bash\n\nls ~;' >> myscript.sh
chmod 755 ./myscript.sh
./myscript.sh

在我的主文件夹中执行,一切按预期进行,它列出了我的主文件夹中的文件

output omitted for brevity -- it worked and listed files as the script intended

在辅助驱动器中执行我得到下面列出的输出(我的 fstab 配置在这个问题中列在下面)。

╭─user@host /media/user/raw/scripts
╰─$ echo '#!/bin/bash\n\nls ~;' >> myscript.sh
╭─user@host /media/user/raw/scripts  
╰─$ chmod 755 ./myscript.sh
╭─user@host /media/user/raw/scripts  
╰─$ ./myscript.sh 
zsh: permission denied: ./myscript.sh

我的/etc/fstab

╭─user@host /media/user/raw/scripts  
╰─$ cat /etc/fstab                                                                130 ↵
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb2 during installation
UUID=<<some_uuid>> /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb1 during installation
UUID=<<some_uuid>>  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0
/dev/disk/by-uuid/<<some_uuid>> /media/user/raw auto user,rw,nofail,x-gvfs-show 0 0

因为这在我的主文件夹中执行正常,而不是在这个安装的驱动器上,我认为问题出在 fstab 配置中的某个地方。有什么想法吗?

您正在隐式指定 noexec,这意味着设备上的任何文件都将不可执行。

这里是man mount

user

Allow an ordinary user to mount the filesystem. The name of the mounting user is written to the mtab file (or to the private libmount file in /run/mount on systems without a regular mtab) so that this same user can unmount the filesystem again. This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).

同一段落还建议修复:使用 user,exec 重新启用用户可挂载 fs 中的执行。