2
[adela@zen ~]$ dir-open /
bash: /home/adela/.toolbox/bin/dir-open: Permission denied

The weird thing is, that both directory and binaries has 777 permisions, and binaries cannot be executed - permission denied.

There is a ~/.toolbox/bin directory, ls -la:

drwxrwxrwx  3 adela adela 4,0K 14. zář 18.34 ./
drwxr-xr-x 10 adela adela 4,0K  5. zář 19.38 ../
-rwxrwxrwx  1 adela adela  302 22. čen 16.13 checksum*
-rwxrwxrwx  1 adela adela 1,3K 18. čec 17.21 dir-open*
-rwxrwxrwx  1 adela adela  937  4. zář 21.05 nas-open*
-rwxrwxrwx  1 adela adela  300  1. úno  2021 po-to-xls*
-rwxrwxrwx  1 adela adela  565  8. zář 16.18 run*
drwxrwxrwx  2 adela adela 4,0K  5. zář 19.03 .stfolder/
-rwxrwxrwx  1 adela adela 1,8K  1. úno  2021 subtitles-renamer*
-rwxrwxrwx  1 adela adela  104 31. říj  2021 terminal*
-rwxrwxrwx  1 adela adela  300  1. úno  2021 xls-to-po*

bin directory is also present in $PATH:

/home/adela/.toolbox/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin

The contents of one of script:

#!/bin/bash
# This script makes file manager open just right.
# called from ~/.toolbox/bin/dir-open

APP="pcmanfm"
DESKTOP=$(wmctrl -d | grep \* | awk '{print $1}') # number of active desktop
APPSINDESKTOP=$(wmctrl -l -x | awk -v var="$DESKTOP" '($2 == var)' | grep -ic "$APP") # windows in active desktop
WIN=$(wmctrl -l -x | awk -v var="$DESKTOP" '($2 == var)' | grep -i "$APP" | awk '{print $1}' | sed -n "1p")
window=$(printf "%d\n" $WIN)


if [[ $APPSINDESKTOP -ge 1 ]]; then
  ACTIVE=$(xdotool getwindowfocus)
  if [[ $ACTIVE = $window ]]; then
    if [ -z "$1" ]; then
        xdotool windowminimize $window # Minimize
      else
        $APP "$1" # New tab
    fi
  else
    if [ -z "$1" ]; then
      wmctrl -ia $WIN # Focus window
    else
      $APP "$1" # New tab
      wmctrl -ia $WIN # Focus window
    fi
  fi
else
  echo "no app on active desktop"
  if [ -z "$1" ]; then
      $APP "/mnt/DATA" -n & # add -n for pcmanfm
    else
      $APP "$1" -n & # add -n for pcmanfm
  fi
  sleep 0.3
  WIN=$(wmctrl -l -x | awk -v var="$DESKTOP" '($2 == var)' | grep -i "$APP" | awk '{print $1}' | sed -n "1p")
  wmctrl -i -R $WIN -e 0,$POSX,$POSY,$WIDTH,$HEIGHT # Resize existing window
  # wmctrl -ia $WIN # Focus window
fi

echo -e "Debug info: \n\nDesktop: $DESKTOP \nWindow: $WIN \nAppsInDesktop: $APPSINDESKTOP\n"

exit 0
  • None of the binaries can be run.
  • Same result when run with sudo.
  • Arco Linux
  • Directory is also shared with another computer (Arch), where binaries are used with no problem.

Any idea what might be potentially wrong?

9
  • What is inside this tool: dir-open? Looks like shell script. Commented Sep 14, 2022 at 17:22
  • Is something mounted with noexec? Commented Sep 14, 2022 at 17:22
  • Yes, those files are bash or python scripts. noexec - no, I'm not aware of that.
    – Sebastian
    Commented Sep 14, 2022 at 17:26
  • Can you execute other scripts or binaries located in or under your home directory?
    – Kusalananda
    Commented Sep 14, 2022 at 17:28
  • Does bash ~/.toolbox/bin/dir-open / give errors? Maybe try adding -x to the command to trace execution.
    – doneal24
    Commented Sep 14, 2022 at 17:35

1 Answer 1

4

worth mentioning is selinux, any time I have a problem that I do not quickly understand or scratch my head on I do a setenforce 0 to temporarily put selinux into permissive mode to see if that's what is causing the problem.

but permission denied on executing a binary what comes to mind is noexec as the mount option. Although I am not sure if that results in a permission denied message or if it results in just nothing ever happening. type mount and see if the mount option of noexec is present for where the binary is located. And then copy the binary from that mounted device to some other folder location which does not have the noexec mount option and see if the binary works.

2
  • You're were right, I found this: /dev/nvme0n1p3 on /home/adela type ext4 (rw,nosuid,nodev,noexec,relatime,user) However, I'm able to run bash script in shell, e.g. bash script.sh with no problems.
    – Sebastian
    Commented Sep 14, 2022 at 17:34
  • My /etc/fstab file did not state neither noexec or exec, so I added exec, and it works now! Thank you! I've learned something today.
    – Sebastian
    Commented Sep 14, 2022 at 17:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .