Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Permission Denied - C Compiled Programs and Script
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Sun Apr 20, 2008 2:17 pm    Post subject: [SOLVED]Permission Denied - C Compiled Programs and Script Reply with quote

There is something in my machine that is drivin' me crazy ò.Ó

Everytime I try to run a simple bash script I get an "bash: ./[scriptname]: Permission denied".
And YEAH, it have execution permission. Usually I can avoid problems just using a "sh ./[scriptname]", but some big scripts, that call another scripts or even some makefiles don't work propertly - and this is really anyoing!!!

The great problem of all is that I'm trying to make some c++ programs for my college, and it don't run the programs, with the same error. And there is no way to run at all, there's not an "sh" for c compiled programs...

I'm using gcc 4.1.2 ( and yeah, I'm using "g++" intead of "gcc" to compile... ) with a Q6600 processor.
For the love of God, a quick solution, since I need to do this work ><"
_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)


Last edited by Holysword on Mon Apr 28, 2008 12:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
avendesora
Veteran
Veteran


Joined: 16 Aug 2002
Posts: 1528
Location: Betelgeuse vicinity

PostPosted: Sun Apr 20, 2008 2:22 pm    Post subject: Reply with quote

Check that the filesystem where all these are located isn't mounted with the "noexec" option.
_________________
I won't disclose my real .sig for less than $10.
Back to top
View user's profile Send private message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Sun Apr 20, 2008 2:26 pm    Post subject: Reply with quote

In fstab, you mean? They are all at my main disk, and in fstab the only partition with noexec is shm. Is this right?
_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Sat Apr 26, 2008 5:29 pm    Post subject: Reply with quote

I stil unable to run scripts without use "sh" command, and I can't run compiled programs that I write. I tried Intel Fortran Compiler and I couldn't even compile.
Any clue?!?! ><"
_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
didl
Developer
Developer


Joined: 09 Sep 2003
Posts: 1072
Location: Pittsburgh, PA

PostPosted: Sun Apr 27, 2008 10:02 am    Post subject: Reply with quote

Could you please post the output of "ls -la" of one of the
directories containing such a script as well as the
ouput of "whoami".
Back to top
View user's profile Send private message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Sun Apr 27, 2008 10:47 am    Post subject: Reply with quote

Code:
kuroiryu scripts # ls -la
total 8
drwxr-xr-x 2 holysword holysword  96 2008-04-27 12:44 .
drwxr-xr-x 6 holysword holysword 264 2008-03-16 18:30 ..
-rwxr-xr-x 1 holysword holysword 310 2008-04-05 11:17 fixer
-rwxr-xr-x 1 holysword holysword 121 2008-04-20 09:17 getip
kuroiryu scripts # whoami
root
kuroiryu scripts #   

_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
didl
Developer
Developer


Joined: 09 Sep 2003
Posts: 1072
Location: Pittsburgh, PA

PostPosted: Sun Apr 27, 2008 1:52 pm    Post subject: Reply with quote

Hmm, that looks all right. Could you try boiling down the script
to the simplest possible case (e.g. a single echo statement)
that still has this problem, and then post it.
Also, what shell are you running in your terminal? Finally,
make sure that your bashrc or cshrc files don't contain
anything that could trigger this; the --norc and --noprofile
options for bash may help.
Back to top
View user's profile Send private message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Sun Apr 27, 2008 2:54 pm    Post subject: Reply with quote

Code:
kuroiryu scripts # cat ./simple
echo "hi there!"

kuroiryu scripts # ./simple
bash: ./simple: Permission denied
kuroiryu scripts #

This in xterm, konsole, eterm and every single terminal emulator I tried - including the real terminal, that you got with a CTRL+ALT+F1 =P

About those options, you meant to start bash with those options, right? I tried "bash -norc -noprofile" and got the same result.
I'm wondering if this hasn't something to do with quad core processor and/or those problems with 32/64 bits... I dunno ><"
_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 7742
Location: beyond the rim

PostPosted: Sun Apr 27, 2008 10:52 pm    Post subject: Reply with quote

What's the output of `mount`? (there are some mount options that imply noexec)
Does the script/executable work when put in /usr/local/bin?
Back to top
View user's profile Send private message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Mon Apr 28, 2008 4:30 am    Post subject: Reply with quote

Code:
kuroiryu ~ # mount
/dev/sda3 on / type reiserfs (rw,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)
udev on /dev type tmpfs (rw,nosuid,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec)
cachedir on /lib64/splash/cache type tmpfs (rw,relatime)
/dev/sda1 on /boot type ext2 (rw,noatime)
/dev/sda4 on /Lago type reiserfs (rw,noexec,nosuid,nodev,noatime)
shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)
/dev/sr0 on /mnt/dvdup type iso9660 (ro,noexec,nosuid,nodev)
/dev/sr1 on /mnt/dvddw type iso9660 (ro,noexec,nosuid,nodev)


Yeah you got it...the things are in the /dev/sda4 partition. Someone asked already, then I checked fstab, but there's nothing wrong with that:
Code:
kuroiryu ~ # cat /etc/fstab
/dev/sda1               /boot           ext2            defaults,noatime        1 2
/dev/sda2               none            swap            sw              0 0
/dev/sda3               /               reiserfs        noatime         0 1
/dev/sda4               /Lago           reiserfs        noatime,users   0 1
/dev/sr0                /mnt/dvdup      auto            noauto,ro,users 0 0
/dev/sr1               /mnt/dvddw       auto            noauto,ro,users 0 0
/dev/sdb               /mnt/usb1        auto            noauto,rw,users 0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0
kuroiryu ~ #


Hwo to fix it?
_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 7742
Location: beyond the rim

PostPosted: Mon Apr 28, 2008 5:40 am    Post subject: Reply with quote

The 'users' mount option is the problem (see `man mount`).
Back to top
View user's profile Send private message
Holysword
Guru
Guru


Joined: 19 Nov 2006
Posts: 400
Location: Greece

PostPosted: Mon Apr 28, 2008 12:37 pm    Post subject: Reply with quote

:oops:
That simples ><" ?
Well, I setted to "user,exec", so I can still mounting it and executing...
Thx you all
_________________
Intel Q6600 | 8600GT 512MB | GA-P35-DS3 | 2.6.30-rc5-zen0

"Nolite arbitrari quia venerim mittere pacem in terram non veni pacem mittere sed gladium" (Yeshua Ha Mashiach)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum