LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-09-2008, 12:45 AM   #1
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
no exec permission on my data partition


I've got a dedicated partition for all my data (music, films, etc). There's also
a directory with my scripts there. Whenever I learn bash or python I put those scripts to this partition. It is mounted in the following way:
Code:
/dev/sda10      /home/sycamorex/data ext3 auto,rw,exec,user       0       0
The problem is that I can't execute any script stored on that partition.
I always get the 'permission denied' error. I even granted a+x permissions on the script directories and files, but still without any success.
Code:
-rwxrwxrwx 1 sycamorex sycamorex 418 2008-09-03 23:59 ftp_file.py
If I copy them to my home directory everything is fine, so I assume it must be some issue with mounting it, isn't it?
 
Old 11-09-2008, 03:56 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
SE Linux context maybe (check syslog/auditd.log)?
 
Old 11-09-2008, 12:25 PM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836

Original Poster
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Thanks for your reply. Selinux is in the permissive mode, so it shouldn't be in the way. I've checked all the logs in /var/log
and there was no mention of anything that could be related to it
It applies both to debian and fedora. Perhaps it's just a security feature built in the kernel? But then, what would be the fstab 'exec' option for?
 
Old 11-09-2008, 05:25 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by sycamorex View Post
It applies both to debian and fedora. Perhaps it's just a security feature built in the kernel? But then, what would be the fstab 'exec' option for?
I doubt it's some security feature but hey, what do I know?.. Give us a strace of something simple?
 
Old 11-09-2008, 06:25 PM   #5
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836

Original Poster
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
thanks for the reply. I got it. While I was preparing the strace output, it dawned on me.
Although I have got appropriate shebangs in the scripts, in order to execute scripts from the data partition I need to specify the correct interpreter:
python ./script.py
bash ./script
Why is that? I can live with it, but is it possible to resolve it?
 
Old 11-09-2008, 06:37 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Hmm. Needing to use "./" ("here") is typical for $PATH issues but it doesn't explain the permission problem. At least not to me :-]
 
Old 11-09-2008, 07:01 PM   #7
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836

Original Poster
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Actually, I don't need to use './' (sorry, I didn't check it), however I need to specify the interpreter:
Code:
xtd8865@debtop:~/data$ ./my_script
bash: ./my_script: /bin/bash: bad interpreter: Permission denied
xtd8865@debtop:~/data$ bash my_script
hello world!
xtd8865@debtop:~/data$ ./my_script.py
bash: ./my_script.py: /usr/bin/env: bad interpreter: Permission denied
xtd8865@debtop:~/data$ python my_script.py
hello world
Code:
xtd8865@debtop:~/data$ cat my_script
#!/bin/bash
echo 'hello world!'
exit 0
xtd8865@debtop:~/data$ cat my_script.py
#!/usr/bin/env python
print 'hello world'

Code:
xtd8865@debtop:~/data$ strace ./my_script
execve("./my_script", ["./my_script"], [/* 33 vars */]) = -1 EACCES (Permission denied)
dup(2)                                  = 3
fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f99000
_llseek(3, 0, 0xbfdb70ac, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: Permission denied\n"..., 32strace: exec: Permission denied
) = 32
close(3)                                = 0
munmap(0xb7f99000, 4096)                = 0
exit_group(1)                           = ?
Code:
xtd8865@debtop:~/data$ strace ./my_script.py 
execve("./my_script.py", ["./my_script.py"], [/* 33 vars */]) = -1 EACCES (Permission denied)
dup(2)                                  = 3
fcntl64(3, F_GETFL)                     = 0x2 (flags O_RDWR)
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fc3000
_llseek(3, 0, 0xbfce0fcc, SEEK_CUR)     = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: Permission denied\n"..., 32strace: exec: Permission denied
) = 32
close(3)                                = 0
munmap(0xb7fc3000, 4096)                = 0
exit_group(1)                           = ?
thanks
 
Old 11-10-2008, 06:36 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Nope. Doesn't ring a bell. Must be a fix so simple my mind refused to cache it. Sorry.
 
Old 11-10-2008, 10:53 PM   #9
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836

Original Poster
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Quote:
Originally Posted by unSpawn View Post
Nope. Doesn't ring a bell. Must be a fix so simple my mind refused to cache it. Sorry.
Probably, it is something simple
Can anyone try to execute a simple script from another partition?

thanks
 
Old 11-11-2008, 12:08 AM   #10
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
What permissions do you have set for the directory you're mounting on? I have no problems running scripts from my "/data" disk.
 
Old 11-11-2008, 01:54 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Me neither. The perms are in the OP.
 
Old 11-11-2008, 11:06 AM   #12
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by unSpawn View Post
Me neither. The perms are in the OP.
Well, this is something I've never checked, so pardon my naivete. If you create a directory as read only and mount to it as RWX, does it still wind up as read only or are the permissions expanded by the mount?
 
Old 11-11-2008, 03:49 PM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Quakeboy02 View Post
Well, this is something I've never checked, so pardon my naivete. If you create a directory as read only and mount to it as RWX, does it still wind up as read only or are the permissions expanded by the mount?
Mount trumps directory perms AFAIK.
 
Old 11-11-2008, 04:25 PM   #14
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by unSpawn View Post
Mount trumps directory perms AFAIK.
That'll teach me to RTFMP. I usually use "defaults" for column 4 which is:

defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async.

From: http://www.tuxfiles.org/linuxhelp/fstab.html

Sorry for diverting the thread.
 
Old 11-11-2008, 05:21 PM   #15
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836

Original Poster
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
I remounted /data with 'defaults' as the only option in column 4 and it works like charm. Why on earth didn't I use 'defaults'
in the first place?

thanks
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backing up ~75GB of data on Redhat rel 4 srvr using backup exec shows ~1.3TB of data? unicorntoo Linux - Software 1 05-01-2008 08:32 AM
CRON problem: (rsync: Failed to exec ssh: Permission denied (13)) Fairys Fedora 6 01-16-2008 06:34 PM
Data Transfer From Redhat Linux Partition to Fat32 Partition saraturtle Linux - General 20 04-04-2007 05:20 PM
exec cmd=perl... work but exec cgi doenst crions Slackware 5 12-09-2005 12:17 PM
problems to exec files in a fat partition cancan Slackware 1 01-18-2004 04:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:07 AM.

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
Open Source Consulting | Domain Registration