LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   bash: ./program: permission denied (https://www.linuxquestions.org/questions/linux-general-1/bash-program-permission-denied-588723/)

Cinematography 10-01-2007 05:13 PM

bash: ./program: permission denied
 
I'm trying to open a program.

I've tried:
./program
sudo ./program
sh ./program
sudo sh ./program
sudo chmod 777 program
sudo chmod a+rwx program
sudo chmod a+rwX program

But none of these work.

At one time I was able to just click the program to open it, but I messed that up by changing the file association to sh. Now the 'execute' option is gone.

Any help on a way to fix this would be greatly appreciated. I'm using Xubuntu (Ubuntu) 7.04, and the program is called mupen64.

rsashok 10-01-2007 06:07 PM

Are you trying to open a file? Or to run a program? I assume that you meant to run a program.
1. Make sure that the program is in your current directory by entering 'ls -l' at the command prompt.
2. If the command is there then make sure that is has 'execute' attribute, if not then
chmod +x program
3. It should be any messages about permission denied, and you don't need to do any 'sudo ...' (BTW: if you insist on doing 'sudo' make sure that permissions in 'sudoers' file are set correclty)
4. If the 'program' is bash script then the first line should read:

#!/bin/bash

5. If the program is a script you could run it as by entering:
>source program

fudam 10-01-2007 07:23 PM

rsashok brings up a good point of knowing what type of file it is you're trying to execute. You can do this with the "file" command. Some examples from my system:

Code:

$ file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

$ file ~/data/programming/perl/nuke/
/home/user/data/programming/perl/nuke/: directory

$ file ~/data/programming/perl/nuke/nuke.pl
/home/user/data/programming/perl/nuke/nuke.pl: perl script text executable

Sharing your return value will help understand what you're trying to execute.

Cinematography 10-01-2007 08:18 PM

Thank you for the replies!

chmod +x file worked, but it only did when I moved the program from my xfs sda4 partition to my ext3 home folder.

Here is the output for the file command:
Code:

file mupen64
mupen64: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), stripped



All times are GMT -5. The time now is 01:10 AM.