News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Permission Denied though my linux chmod has allowed 777

Started by edcompsci, June 05, 2021, 10:03:14 PM

Previous topic - Next topic

edcompsci

I built a simple program on my linux machine following a tutorial and it builds but I don't see why it is getting Permission Denied when I run it even though I chmod'd the whole directory recursively to 777.

Can someone help?

stahta01

Did you try rebooting your computer?
Or you can lookup how to kill a program on Linux because you can not run a program already running on Windows if the file has a file lock on it. The same is likely true on Linux; but, since the file system is different it might not be true.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

edcompsci

Thanks.

to kill linux process (as sudo) you can use

kill [pid]


or

killall [name of program]


or from a ui with system monitor, kill it just like you would in task manager in Windows.


I will see now if there are hanging processes. Thanks again.

edcompsci

#3
No there's no running processes still.

I tried even running codeblocks as sudo and still no luck.

I don't think a reboot will help but I may try that later.

edcompsci


stahta01

You might post the run log and maybe someone could see the cause of the problem.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

edcompsci

#6
Thank you.  Nothing runs at all on any piece of code I create (making small c programs).  Down where the logs are no run log appears, only a build log, and I am clicking and Build and Run.


Here's some example code, code isn't the issue, because no matter what program I run, the Permission error comes up right away without running anything.
#include <stdio.h>
#include <string.h>

int main()
{
char a;double b;float c;int d;char *aa;char e[5];char *ee;

printf("address of a char example: %p\n",&a);//%p is "placeholder"
printf("address of a double example: %p\n",&b);//addresses are in hex
printf("address of a float example: %p\n",&c);
printf("address of an int example: %p\n",&d);

aa=&a;
printf("address of a char a example: %p\n",&a);
printf("pointer to address of char a example: %p\n",aa);

ee=e;
printf("address of a array e example: %p\n",e);
printf("pointer to address of array e example: %p\n",ee);
printf("address symbol used (optional), array e example: %p\n",&e);
ee=&e[1];
printf("address symbol used for one element, array e example: %p\n",&e[1]);

return (0);
}


It's some kind of configuration, but I haven't pinpointed it. I thought maybe codeblocks had to run as some kind of user and that user had to be in a certain group maybe, but with the linux users command I only see me, no other user.  Then I though well maybe if I do an ls - l that execute and read permissions aren't set on the files, so I set them all to 777 and still no luck.  Now I am thinking that maybe I need to tell codeblocks to allow my username to use it to run programs, but I don't know how I would do that. I clicked around the menus on top a little bit but haven't found anything.


Commaster

That space in "c programs" is very suspicious... Could you try removing spaces from your path?


Commaster

#9
Please share your values for Settings - Environment... - General settings, lower three values.
I've set mine to
/bin/sh -c
xterm -T $TITLE -e
xdg-open

trying to mimic your screenshots.

But I was unable to reproduce your issue:
/media/IDE/ProgrammingCode/0._Console/c_programs$ ls -lAtr
total 28
-rw-rw-r-- 1 commaster commaster  1080 Jun  7 07:48 c_programs.cbp
-rw-r--r-- 1 commaster commaster   738 Jun  7 07:50 main.c
drwxr-xr-x 2 commaster commaster  4096 Jun  7 07:50 .objs
-rwxrwxr-x 1 commaster commaster 14472 Jun  7 07:50 pointers_addressof


address of a char example: 0x7fffd37732df
address of a double example: 0x7fffd37732e8
address of a float example: 0x7fffd37732e0
address of an int example: 0x7fffd37732e4
address of a char a example: 0x7fffd37732df
pointer to address of char a example: 0x7fffd37732df
address of a array e example: 0x7fffd37732f3
pointer to address of array e example: 0x7fffd37732f3
address symbol used (optional), array e example: 0x7fffd37732f3
address symbol used for one element, array e example: 0x7fffd37732f4

Process returned 0 (0x0)   execution time : 0.005 s
Press ENTER to continue.


P.S. Also try executing the compiled binary from the terminal using ./pointers_addressof
I also suspect that "/media/IDE/ProgrammingCode/0._Console/c_programs/pointers_addressof" is a folder, not your executable, in which case "sh" says "Permission denied" to execute a folder.

edcompsci

#10
here's my shell settings. Not sure where you entered the xdg-open part.



It isn't trying to execute a folder because all I'm doing is clicking Build and Run.


Sorry, no it's not a folder. At first it was a file that I forgot to put the .c extension on but the I got the same error with the same program with a .c extension, and 5 or more other .c programs all the same error.

I'll try changing the /bin/sh to /bin/bash

oBFusCATed

I don't see full build log in your posts, please post one.
Also after a build please post the output of "ls -lAtr" in the folder where you expect the executable to be.
The output should look something like the output from Commaster.
You have to have x-es in the permissions for the executable.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

edcompsci

changing to /bin/bash did nothing. maybe it needs to run in csh.. will try

edcompsci


oBFusCATed

Quote from: oBFusCATed on June 10, 2021, 01:58:03 AM
I don't see full build log in your posts, please post one.
Also after a build please post the output of "ls -lAtr" in the folder where you expect the executable to be.
The output should look something like the output from Commaster.
You have to have x-es in the permissions for the executable.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]