LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   no exec permission on my data partition (https://www.linuxquestions.org/questions/linux-general-1/no-exec-permission-on-my-data-partition-682088/)

sycamorex 11-09-2008 12:45 AM

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?

unSpawn 11-09-2008 03:56 AM

SE Linux context maybe (check syslog/auditd.log)?

sycamorex 11-09-2008 12:25 PM

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?

unSpawn 11-09-2008 05:25 PM

Quote:

Originally Posted by sycamorex (Post 3336268)
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?

sycamorex 11-09-2008 06:25 PM

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?

unSpawn 11-09-2008 06:37 PM

Hmm. Needing to use "./" ("here") is typical for $PATH issues but it doesn't explain the permission problem. At least not to me :-]

sycamorex 11-09-2008 07:01 PM

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

unSpawn 11-10-2008 06:36 PM

Nope. Doesn't ring a bell. Must be a fix so simple my mind refused to cache it. Sorry.

sycamorex 11-10-2008 10:53 PM

Quote:

Originally Posted by unSpawn (Post 3337744)
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

Quakeboy02 11-11-2008 12:08 AM

What permissions do you have set for the directory you're mounting on? I have no problems running scripts from my "/data" disk.

unSpawn 11-11-2008 01:54 AM

Me neither. The perms are in the OP.

Quakeboy02 11-11-2008 11:06 AM

Quote:

Originally Posted by unSpawn (Post 3338034)
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?

unSpawn 11-11-2008 03:49 PM

Quote:

Originally Posted by Quakeboy02 (Post 3338431)
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.

Quakeboy02 11-11-2008 04:25 PM

Quote:

Originally Posted by unSpawn (Post 3338716)
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.

sycamorex 11-11-2008 05:21 PM

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


All times are GMT -5. The time now is 08:39 PM.