Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] shell-scripts not executable though x bit set
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
commander-keen
n00b
n00b


Joined: 09 Oct 2013
Posts: 47
Location: Europe

PostPosted: Wed Oct 30, 2013 6:52 am    Post subject: [SOLVED] shell-scripts not executable though x bit set Reply with quote

Hello,

I recently installed Gentoo. My problem is: I can't launch scripts but i do not understand why.
I have my personal scripts in ~/bin/, which is part of the PATH variable:

maex@celadon:~ $ echo $PATH
/usr/share/tomcat7/bin/:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i486-pc-linux-gnu/gcc-bin/4.6.3:/home/maex/bin:/opt/android/tools:/opt/android/platform-tools

so randomly picking one script the permissions look good (x bit is set):
-rwx------ 1 maex users 229 Oct 18 09:50 publish

But when I try to launch the script, I get this:
maex@celadon:~ $ publish
bash: /home/maex/bin/publish: Permission denied

Same when I try to launch them directly from ~/bin
maex@celadon:bin $ ./publish
bash: ./publish: Permission denied

But: I can do this (without knowing the difference):
maex@celadon:bin $ . publish
(note the blank between dot and publish)

Someone told me this may be linked to fstab settings, since I can launch the scripts when they lie e.g. in /tmp
fstab for my home partition looks like this:
/dev/sda3 /home ext3 user 0 1

Thanks in advance,
Max


Last edited by commander-keen on Wed Oct 30, 2013 8:36 am; edited 1 time in total
Back to top
View user's profile Send private message
snkmoorthy
Guru
Guru


Joined: 19 Nov 2002
Posts: 376

PostPosted: Wed Oct 30, 2013 7:18 am    Post subject: Reply with quote

what is the shell interpreter set in the script?

Code:
#!/bin/sh
Back to top
View user's profile Send private message
blu3bird
Retired Dev
Retired Dev


Joined: 04 Oct 2003
Posts: 612
Location: Munich, Germany

PostPosted: Wed Oct 30, 2013 8:28 am    Post subject: Re: shell-scripts not executable though x bit set Reply with quote

commander-keen wrote:
/dev/sda3 /home ext3 user 0 1

The mount option user implies the noexec option which prevents executions.

You can either exec bash publish, this way you won't really execute publish but /bin/bash which is not on that filesystem. Or you could change your fstab to user,exec and remount or reboot.
_________________
Black Holes are created when God divides by zero!
Back to top
View user's profile Send private message
commander-keen
n00b
n00b


Joined: 09 Oct 2013
Posts: 47
Location: Europe

PostPosted: Wed Oct 30, 2013 8:35 am    Post subject: Re: shell-scripts not executable though x bit set Reply with quote

[quote="blu3bird"]Or you could change your fstab to [i]user,exec[/i] and remount or reboot.[/quote]

Yes!
Thank you!
Back to top
View user's profile Send private message
py-ro
Veteran
Veteran


Joined: 24 Sep 2002
Posts: 1733
Location: St. Wendel

PostPosted: Wed Oct 30, 2013 11:53 am    Post subject: Reply with quote

And "." is the same as "source".

Code:
help source
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13845

PostPosted: Wed Oct 30, 2013 9:27 pm    Post subject: Reply with quote

Why did you make /home mountable by normal users? On most systems, you want to mount that filesystem automatically at startup and never worry about having users mount it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
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