Permission denied

Hello,

I am having an issue running a program I just compiled. I am compiling it in a directory on my data drive formatted as ext4 set chmod a+rwx. g++ compiles it fine but when I go to run it tells me Permission denied even when trying with sudo but if copy it to anywhere on / it runs fine with desired results.

Here are the permissions of the program folder.

1
2
3
4
5
drwxrwxrwx 2 nobody     nogroup     4096 Aug  7 23:36 .
drwxrwxrwx 7 root       root        4096 Aug  7 10:26 ..
-rwxrw-rw- 1 nobody     nogroup      529 Aug  7 10:42 main.cpp
-rwxrwxr-x 1 wunderbred wunderbred 13774 Aug  7 23:36 minmax
-rwxrw-rw- 1 nobody     nogroup      393 Aug  7 10:30 minmax.h


any ideas of whats happening?
Last edited on
Make sure you're running the correct minmax, type ./minmax. If that runs, type in "whence -v minmax to show you the version you might have been running before.
Last edited on
This is what I did.

1
2
3
g++ main.cpp -o minmax
./minmax
-bash: ./minmax: Permission denied


so I tried

1
2
sudo ./minmax
sudo: unable to execute ./minmax: Permission denied


I also tried copying it to /local and /local2 but same issue then I tried copying it to / and it ran fine as both my user and as root
What are the directory permissions and who is the owner of the directory and the executable? Is wunderbred a member of nogroup?

It would probably be advised to move the project into a directory owned by the user (wunderbred?).

You also need to insure the executable file is marked executable.


JLB is right: Double-check the permissions of the directory. It looks like the executable has the correct permissions for anyone to run it; however, the current directory is owned by nobody and its group is nogroup. Change those and see what happens.
ok so I changed directory ownereship with chown and it still didn't run and convinced it was something else because root didn't even have permission to run. I checked fstab and all 3 data drives were mounted with options users,default so I removed the users from all 3 remounted my drives and it ran, I even recompiled with original directory ownership and it still ran. I feel kinda stupid now.

Thanks for the help.
Glad you got it figured out!
Topic archived. No new replies allowed.