permission denied(2)

Hi.
Help please.
I g++'d my test program and then typed './a.out'. Anything wrong? But the only thing I got was 'bash: ./a.out: Permission denied'
I also have tried 'chmod 777 ./a.out' but still get the same error on './a.out'

Please help
Thanks in advance
Please give the command line used to compile the program(including the prompt: # or $).
Sorry but what difference does it make?

Here it is:
$ g++ vector_swap.cpp
Last edited on
Then try:

$ chmod u+x a.out or $ chmod a+x a.out
Give the output of the following commands (execute from the directory where your program is located)
$ pwd
$ mount -l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
soheil@soheil-desktop:/media/2318-8E84/Test_suite$ pwd
/media/2318-8E84/Test_suite
soheil@soheil-desktop:/media/2318-8E84/Test_suite$ mount -l
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda6 on /boot type ext4 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/soheil/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=soheil)
/dev/sr0 on /media/disk type iso9660 (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks)
/dev/sda8 on /media/2318-8E84 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)
/dev/sdb1 on /media/TOSHIBA type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks) [TOSHIBA]
/dev/sda8 on /media/2318-8E84 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)
man mount wrote:
showexec
If set, the execute permission bits of the file will be allowed only if the
extension part of the name is .EXE, .COM, or .BAT. Not set by default.
so you could try to put an "allowed" executable extension.
You could also try to mount without the `showexec' option, using `defaults' or `exec'
I changed the permissions, but still failed:
1
2
3
soheil@soheil-desktop:/media/2318-8E84/Test_suite$ chmod 777 ./a.out
soheil@soheil-desktop:/media/2318-8E84/Test_suite$ ./a.out
bash: ./a.out: Permission denied

ٌWhat do I do?
Last edited on
I did a quick search and found that showexec is a common problem in Ubuntu 11.10, it gets set as the default for all USB devices when it mounts, and it will even prevent you from changing file permissions... http://superuser.com/questions/390182/file-execute-permissions-for-automounted-usb-hdd-ubuntu-11-10
The site I provided gives instructions on how to fix the problem. This was the first site I landed on, so also try searching for more options for turning off showexec.
Last edited on
Topic archived. No new replies allowed.