LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hello,
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
#!/bin/sh
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, 01:31 AM   #2
ukiuki
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, 11:12 AM   #3
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
Quote:
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, 01:07 PM   #4
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,962

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

Last edited by rknichols; 11-23-2011 at 01:12 PM. Reason: Add shell invocation alternative
 
1 members found this post helpful.
Old 11-23-2011, 02:51 PM   #5
gary185
Member
 
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.
 
  


Reply


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 08:30 AM
Permission denied executing cgi-script Geminias Linux - Networking 4 07-31-2006 11:02 PM
Permission Denied for script accessing text file lobo1 Linux - General 2 06-28-2005 01:46 PM
crontab failure: permission denied trying to run script hedpe Linux - Software 5 05-03-2005 08:07 PM
permission denied when executing my own script Red Squirrel Linux - Newbie 3 03-07-2004 09:21 PM


All times are GMT -5. The time now is 02:43 PM.

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