This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

c on ubuntu

 
amit nagarkoti
Greenhorn
Posts: 3
Java Ubuntu Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've been trying on c code on ubuntu using gcc , the program compiles , but when i run it using ./a.out or ./myfile it always ends up with the error permission denied .
i don't know how to get rid of it i've tried remounting the parttion in executable form but it didn't helped either , im using ubuntu 10.10 .
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never had that problem. Tryand see whether the files have execution permission (x). Try . . . but whenever I have used gcc, the output files have automatically had execute permission.
If that fails, try again in a directory you have "ownership" of.
 
amit nagarkoti
Greenhorn
Posts: 3
Java Ubuntu Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i moved the current files to home directory everthing worked fine but on the previous location the error remains same

scylla@scylla-Inspiron-N5010 /media/softwares/learning/c $ chmod a+x *
scylla@scylla-Inspiron-N5010 /media/softwares/learning/c $ ls -l
total 41
-rw------- 1 scylla scylla 7155 2011-03-17 13:10 a.out
-rw------- 1 scylla scylla 7257 2011-03-14 21:31 cc
-rw------- 1 scylla scylla 90 2011-03-14 21:30 copychar.c
-rw------- 1 scylla scylla 7155 2011-03-14 12:06 hel
-rw------- 1 scylla scylla 7091 2011-03-14 07:52 hello
-rw------- 1 scylla scylla 74 2011-03-17 13:10 hello.c
-rw------- 1 scylla scylla 7091 2011-03-14 19:20 new
scylla@scylla-Inspiron-N5010 /media/softwares/learning/c $ ./a.out
bash: ./a.out: Permission denied

anyways im able to run it now atleast on adifferent location and thanks for the reply
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17639
39
Android Eclipse IDE Linux
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the "execute" bit wasn't set on a.out, even when you forced it. It's possible that the media was mounted with the "-r" (readonly) option ???

There are a few even more subtle reasons why the "x" bit might now be honored (like umask), but that's more than I normally deal with myself.
 
Adam Koblentz
Greenhorn
Posts: 19
Java Mac OS X Objective C
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're doing this on a location mounted through the "media" mount point. There's an excellent chance your usual account doesn't have permissions to do that. Generally, ubuntu is very strict about mount points. Try sudo and see if that works. Maybe tweak your permissions.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic