You are not logged in.

#1 2013-03-02 16:39:32

syncrtl64
Member
Registered: 2013-02-17
Posts: 3

[SOLVED] Bash giving permission denied on EVERYTHING

Ok, my first post, my first REAL problem in Arch Linux smile

Any binary file or bash script I try to execute, bash just says Permission Denied. This happens as a normal user, as a user with sudo permissions and also as a root user.
The problem:

 $ ./test
bash: ./test: Permission denied
$cat test
#!/bin/bash
echo 'lol'
$ls -l test
-rwxr-xr-x 1 syn users 23 Mar  2 18:26 test
#./test
bash: ./test: Permission denied
#file test
test: Bourne-Again shell script, ASCII text executable

It seems that when i run the simple test script by typing "sudo sh test", it works(shows the 'lol' string) but when I try to run this script:

 
#!/bin/sh

LOCALFILE=`readlink -f $0`
LOCALDIR=`dirname $LOCALFILE`

env LD_LIBRARY_PATH="$LOCALDIR/libs" $LOCALDIR/bin/AndroVMplayer

It doesn't work, it just shows this:

$sudo sh AndroVMplayer 
env: /mnt/Diverse/OSes/AndroVMplayer-Linux64/bin/AndroVMplayer: Permission denied

I am REALLY baffled by this problem, maybe I miss something too obvious... I really have no idea. Of course I already googled the problem, but I usually found out about beginners forgetting about the executable bit.
This problem also goes to binary files like this:

[syn@deathstar NAPALM_x64]$ sudo sh NAPALM 
[sudo] password for syn: 
NAPALM: NAPALM: cannot execute binary file
[syn@deathstar NAPALM_x64]$ ./NAPALM
bash: ./NAPALM: Permission denied
[syn@deathstar NAPALM_x64]$ su
Password: 
[root@deathstar NAPALM_x64]# ./NAPALM
bash: ./NAPALM: Permission denied
[root@deathstar NAPALM_x64]# file NAPALM 
NAPALM: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xb034cb4e3193e049fe70e4dcd1c16e73a2ce2045, not stripped
#uname -a
Linux deathstar 3.7.9-1-ARCH #1 SMP PREEMPT Mon Feb 18 02:13:30 EET 2013 x86_64 GNU/Linux
#cat /etc/passwd | grep syn
syn:x:1000:100::/home/syn:/bin/bash
#cat /etc/passwd | grep root
root:x:0:0:root:/root:/bin/bash
#ls -l /bin/bash
lrwxrwxrwx 1 root root 15 Jan 27 02:22 /bin/bash -> ../usr/bin/bash
#ls -l /usr/bin/bash
-rwxr-xr-x 1 syn root 738008 Jan 27 02:22 /usr/bin/bash
$ cat /etc/fstab
# 
# /etc/fstab: static file system information
#
# <file system>	<dir>	<type>	<options>	<dump>	<pass>
tmpfs		/tmp	tmpfs	nodev,nosuid,size=8G	0	0
# UUID=8d8f68bb-f8db-4b70-a7b2-6cacd83fad4f
/dev/sda5           	/         	ext4      	rw,noatime	0 1
/dev/sda3  /mnt/Diverse  ntfs-3g  auto,exec,rw,user,fmask=0022,dmask=000,uid=1000,gid=100,async        0  0
[syn@archstar ~]$ cat /etc/mtab
rootfs / rootfs rw 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
sys /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
dev /dev devtmpfs rw,nosuid,relatime,size=1977280k,nr_inodes=494320,mode=755 0 0
run /run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0
/dev/sda5 / ext4 rw,noatime,data=ordered 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /sys/fs/cgroup tmpfs rw,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls cgroup rw,nosuid,nodev,noexec,relatime,net_cls 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=27,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,relatime,size=8388608k 0 0
fusectl /sys/fs/fuse/connections fusectl rw,relatime 0 0
/dev/sda3 /mnt/Diverse fuseblk rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

Last edited by syncrtl64 (2013-03-02 19:38:29)

Offline

#2 2013-03-02 18:32:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,381

Re: [SOLVED] Bash giving permission denied on EVERYTHING

Any chance you have a volume mounted with noexec  ??
Check the output of mount


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2013-03-02 18:39:44

syncrtl64
Member
Registered: 2013-02-17
Posts: 3

Re: [SOLVED] Bash giving permission denied on EVERYTHING

 /dev/sda3 on /mnt/Diverse type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096) 

This is weird, since in /etc/fstab i have it mounted like this:

 /dev/sda3  /mnt/Diverse  ntfs-3g  auto,exec,rw,user,fmask=0022,dmask=000,uid=1000,gid=100,async        0  0 

How could I fix this?(I can't beleive I didn't noticed that noexec flag)

Offline

#4 2013-03-02 19:30:09

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,381

Re: [SOLVED] Bash giving permission denied on EVERYTHING

As usual, I think Karol may have the answer.  Reader's digest version, make the exec mount option for ntfs-3g  the last option in the list.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB