I can't execute the file, even though I changed ownership and chmod

There is a file located in another internal partition that I wish to execute. I chown to my current user and I marked it as executable chmod a+x to the script and I could do this without any errors but still when I run ./ it gives me this error message

fish: The file “./Abstract_Kandinsky_Art” is not executable by this user

Here is my permissions
-rwxrwxrwx

and users
user1 root

What does the command file ./Abstract_Kandinsky_Art output?

It outputs this:

#!/bin/sh

APPDIR=$(readlink -f "$0")
APPDIR=$(dirname "$APPDIR")
java -Xms64m -Xmx512m -Djna.nosys=true -Djava.library.path="$APPDIR:$APPDIR/lib" -cp "$APPDIR:$APPDIR/lib/Abstract_Kandinsky_Art.jar:$APPDIR/lib/core.jar:$APPDIR/lib/jogl-all.jar:$APPDIR/lib/gluegen-rt.jar:$APPDIR/lib/jogl-all-natives-linux-amd64.jar:$APPDIR/lib/gluegen-rt-natives-linux-amd64.jar:$APPDIR/lib/jl1.0.1.jar:$APPDIR/lib/jsminim.jar:$APPDIR/lib/minim.jar:$APPDIR/lib/mp3spi1.9.5.jar:$APPDIR/lib/tritonus_aos.jar:$APPDIR/lib/tritonus_share.jar" Abstract_Kandinsky_Art "$@"

If that is what the command file outputs there is something fairly unique about your system. Do you have file aliased?

Can we see the output of ls -l ./Abstract_Kandinsky_Art

Well it is under the Megasync folder

Sure mate

-rwxrwxrwx 2 user1 root 551 Oct 25 23:17 Abstract_Kandinsky_Art*

Uhh…what? I am not sure we are communicating well. There is a Linux command that is named “file”. I was asking you to run the command:

file ./Abstract_Kandinsky_Art

Normally, it would output information about the file in question, not the contents of it.

Oh sorry, it is this

./Abstract_Kandinsky_Art: POSIX shell script, ASCII text executable, with very long lines

Two questions:

  • Have you tried running it from within a bash shell?
  • How is the volume that the file is in mounted? Can we see the output of mount that relates to that volume?

Yes, still can’t run it.

Sure mate. I just simply typed mount in the same directory as where that file is located, is that correct? Here is the output of it:

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8107408k,nr_inodes=2026852,mode=755)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/mapper/luks-1f3b8550-37dc-480f-a167-ae030b5db328 on / type ext4 (rw,noatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
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/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
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/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=19644)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,noatime)
/dev/sda2 on /run/media/Windows10 type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
/dev/sda4 on /boot type ext4 (rw,noatime)
/dev/sda5 on /home type ext4 (rw,noatime)
/dev/sda3 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sdb2 on /run/media/Large type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
/dev/sdb3 on /run/media/Large_linux type ext4 (rw,noatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1626760k,nr_inodes=406690,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)

What is the full path of Abstract_Kandinsky_Art?

/run/media/Windows10 and /run/media/Large are both mounted with noexec so if it is inside one of those it probably won’t run.

Sorry how would I change these, I believe I would have to edit the /etc/fstab file but what do I change?

Can we see the contents of your existing /etc/fstab?

Also, it looks like they are currently being automounted using fuseblk. What filesystem is on those volumes? Are they both ntfs?

Sure it is

# /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>
UUID=51d91251-9891-4b15-86fa-33e972a22b04 /boot          ext4    defaults,noatime 0 2
UUID=ee052484-aab7-4ef1-8f74-24e6ccb5c5b7 /home          ext4    defaults,noatime 0 2
/dev/mapper/luks-1f3b8550-37dc-480f-a167-ae030b5db328 /              ext4    defaults,noatime 0 1
UUID=CACA-DC9D                            /boot/efi      vfat    umask=0077 0 2
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
UUID=D660723E60722601   /run/media/Windows10    ntfs-3g         auto,users,permissions 0 2
UUID=E4DA3432DA33FEFC  /run/media/Large         ntfs-3g         auto,users,permissions 0 2
UUID=b5a38b96-c66f-4d70-8cda-3a9fcef804fb  /run/media/Large_linux        ext4             defaults,noatime 0 2

I manually setted these partitions to mount through the /etc/fstab file.

they are ntfs but it is mounted as ntfs-3g

It looks like you need to add exec to the options section so change it like this:

UUID=D660723E60722601   /run/media/Windows10    ntfs-3g         auto,users,permissions,exec 0 2
UUID=E4DA3432DA33FEFC  /run/media/Large         ntfs-3g         auto,users,permissions,exec 0 2

That being said, since everything on an ntfs partition is probably going to be executable there is some danger in doing this.

A much better solution would be moving that script to a non-ntfs volume.

Lastly, permanently mounting volumes to /run is really not the best practice since /run is typically a tmpfs.

I see, I will take caution with this :slight_smile:

Yes makes sense.

Oh, so it should have been mounted in /mnt instead?

/mnt will work fine but so would any permanent part of the filesystem.

Is this where I should typically mount partitions though for internal partitions?

There are no hard and fast rules for that. You can put them where it makes sense for you.

Personally, I have filesystems mounted all over the place including /mnt

Just make sure you test your new fstab entries before you reboot.

1 Like