Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-23-2011, 12:28 AM   #1
Glenn D.
Registered: May 2009
Location: ACT - Australia
Distribution: Opensuse x86_64 (Latest)
Posts: 128

Rep: Reputation: 16
Why do I get a permission denied from a script ?

Why do I get a permission denied from a script ?
Thanks Glenn

Using openSUSE 12.1 64 bit
Sequence of steps:

# id
uid=0(root) gid=0(root) groups=0(root)

# ll
total 8
drwxr-xr-x 2 root root 40 Nov 23 14:09 disk
drwxr-xr-x 2 root root 40 Nov 23 14:09 disk2
-rwx------ 1 root root 29 Nov 23 14:22 off
-rwx------ 1 root root 39 Nov 23 17:20 on

# cat on
mount /dev/sdb6 /media/disk

# chmod 700 on

# ./on
bash: ./on: Permission denied

# dmesg
[ 2858.804066] REISERFS (device sdb6): found reiserfs format "3.6" with standard journal
[ 2858.804111] REISERFS (device sdb6): using ordered data mode
[ 2858.817790] REISERFS (device sdb6): journal params: device sdb6, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
[ 2858.819147] REISERFS (device sdb6): checking transaction log (sdb6)
[ 2858.874905] REISERFS (device sdb6): Using r5 hash to sort names
Old 11-23-2011, 12:31 AM   #2
Senior Member
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Try 755 instead.
Old 11-23-2011, 10:12 AM   #3
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
Originally Posted by ukiuki View Post
Try 755 instead.
Why would this work? If owner (root in this case) has execute perm, then why does the group bit matter?

I tried creating a script with 700 perm and was able to execute it.
Old 11-23-2011, 12:07 PM   #4
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 4,025

Rep: Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776Reputation: 1776
Auto-mounting of file systems under /media typically includes the "noexec" option. Try
mount -o remount,exec /media/disk
Since it's a script, you can also run it by invoking the shell directly:
sh ./on
For that case, only read permission is needed.

Last edited by rknichols; 11-23-2011 at 12:12 PM. Reason: Add shell invocation alternative
1 members found this post helpful.
Old 11-23-2011, 01:51 PM   #5
Registered: Jul 2011
Posts: 113

Rep: Reputation: Disabled
try moving the script to your home directory.
i never have figured out why but scripts won't
run from a disk like that.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a bash script from PHP - permission denied helsing Linux - Server 3 08-21-2008 07:30 AM
Permission denied executing cgi-script Geminias Linux - Networking 4 07-31-2006 10:02 PM
Permission Denied for script accessing text file lobo1 Linux - General 2 06-28-2005 12:46 PM
crontab failure: permission denied trying to run script hedpe Linux - Software 5 05-03-2005 07:07 PM
permission denied when executing my own script Red Squirrel Linux - Newbie 3 03-07-2004 08:21 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration