脚本不会执行

脚本不会执行

我的 ~/bin 中的所有脚本都以“#!/bin/sh”作为第一行,但如果没有 sh,这些脚本将无法运行。当我将所有个人数据转移到 ntfs 分区并在主目录中创建指向它们的符号链接后,出现了此问题。我想我已经在所有受影响的文件夹中正确设置了权限(774 到 bin 中的目录和文件,664 到所有其他文件),并将此条目添加到 /etc/fstab 中:

UUID=5BE8B8E020325D09                                 /mnt/DATA       ntfs-3g auto,users,permissions                       0           0

问题就是这样的:

saga@terminal:~$ syncit a b
bash: /home/saga/bin/syncit: Permission denied
saga@terminal:~$ sh ~/bin/syncit a b
    <works correctly>

知道这里发生了什么吗?

ls -l 的输出:

对于 /mnt/DATA/bin/:

-rwxrwxr-- 1 saga 1001   67 Sep 22 23:56 bldcpp
-rwxrwxr-- 1 saga 1001   23 Sep 22 23:56 cnl
-rwxrwxr-- 1 saga 1001   62 Sep 22 23:57 conct
-rwxrwxr-- 1 saga 1001   23 Sep 22 23:57 cx
-rwxrwxr-x 1 saga 1001  479 Sep 22 23:44 defperms
-rwx------ 1 saga saga    0 Sep 22 23:48 ju
-rwxrwxr-- 1 saga 1001   27 Sep 22 23:57 mke
-rwxrwxr-- 1 saga 1001   58 Sep 22 01:54 process
-rwxrwxr-- 1 saga 1001  329 Sep 22 23:58 ptr
-rwxrwxr-- 1 saga 1001 1336 Sep  1 22:48 syncit
-rwxrwxr-- 1 saga 1001  639 Sep  8 12:13 vidplacer

对于〜/ bin:

lrwxrwxrwx 1 saga saga 13 Sep 22 04:04 /home/saga/bin -> /mnt/DATA/bin

挂载输出:

saga@terminal:~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs       (rw,nosuid,relatime,size=1963732k,nr_inodes=490933,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=396576k,mode=755)
none on /dev/.bootchart/proc type proc (rw,relatime)
/dev/mapper/terminal--vg-root on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (rw,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event,release_agent=/run/cgmanager/agents/cgm-release-agent.perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb,release_agent=/run/cgmanager/agents/cgm-release-agent.hugetlb)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids,release_agent=/run/cgmanager/agents/cgm-release-agent.pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,clone_children)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=35,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sda10 on /mnt/DATA type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allo    w_other,blksize=4096)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
cgmfs on /run/cgmanager/fs type tmpfs (rw,relatime,size=100k,mode=755)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=396576k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
gvfsd-fuse on /root/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)

我将数据移至 sda10

答案1

/mnt/DATA装有noexec旗帜。作为快速修复,/mnt/DATA无需重新安装noexec,即

mount -o remount,exec /mnt/DATA

为了持久性,请修改相应的条目,/etc/fstab以便默认情况下不设置此标志。

相关内容