Welcome, Guest. Please login or register.
April 20, 2014, 20:44:32 PM
Home Help Search Calendar Login Register
Show unread posts since last visit.
News: Let Pardus-Anka become #1: Pardus-Anka Bug ReportPardus-Anka World Google+ | The Pardus wiki  | Visit Pardus-Anka official website  | Register as forum member?  Email the moderator!

+  Pardus Worldforum
|-+  Assistance
| |-+  Pardus for beginners
| | |-+  Running C Program gives Permission Denied
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Running C Program gives Permission Denied  (Read 2040 times)
Azoic
Newbie
*
Posts: 4


View Profile
« on: November 11, 2011, 06:27:10 AM »

Hello,

Just a day old to Pardus and Linux in general. So please inform me if I'm understanding something wrong.

I installed Pardus, gcc, make and system.devel for C programming. It compiles fine (gcc -o Prog_Name Prog_Name.c), but running it (./Prog_Name) returns:
bash: ./Prog_Name: Permission denied.

I am the sole user and have admin rights. What am I doing wrong?
Logged
SW
Guest
« Reply #1 on: November 11, 2011, 06:39:57 AM »

Good morning (in europe) and welcome here!

You must navigate to the same folder where Your "C" program is.

Code:
cd the_program_directory
./program_name

Starting from another path is also possible, but need some more info:
http://learn.clemsonlinux.org/wiki/Basic_Commands

Besides that You probably must mark it first as executable either by GUI (right mouseclick and then settings --> exetutable) or by giving this command:
Code:
sudo chmod a+x myfile

"sudo chmod 775 myfile"  does btw the same!


 Wink
« Last Edit: November 11, 2011, 06:44:20 AM by SW » Logged
Azoic
Newbie
*
Posts: 4


View Profile
« Reply #2 on: November 11, 2011, 06:44:19 AM »

Hey. Thanks for the reply. But I already am in the directory.
Logged
SW
Guest
« Reply #3 on: November 11, 2011, 06:45:36 AM »

Mark it as executable - if this also don´t solve this I´am out!  Sad

Here is a good reference for chmod: http://ss64.com/bash/chmod.html
« Last Edit: November 11, 2011, 06:50:40 AM by SW » Logged
Azoic
Newbie
*
Posts: 4


View Profile
« Reply #4 on: November 11, 2011, 06:52:56 AM »

Currently it has the following permission:
-rw-r--r--

I tried:
chmod +x Prog_Name

and
chmod 777 Prog_Name

but the permissions still are the same.
Logged
SW
Guest
« Reply #5 on: November 11, 2011, 07:02:36 AM »

pls dont´t forget "sudo" at the beginning!

sudo chmod +x Prog_Name
sudo chmod 777 Prog_Name
Logged
Azoic
Newbie
*
Posts: 4


View Profile
« Reply #6 on: November 11, 2011, 07:03:14 AM »

Got it working. The link you sent is very helpful. Just that the file was on my phone (which doubles as my portable storage device). Transferred to folder on harddrive and chmod. Works now.

Thanks!
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!