4

Every time I try to change the permissions of a file with chmod on my Ubuntu with a command like chmod 744 /media/DATEN/Dokumente/Coding/Python/DirFileFuncts.py it doesn't work. I tried octal and =rwx spelling but the output of ls -l won't change and I still get errors like: no Permission if I try to execute a file.

The strange thing is, that I don't get any error message from chmod itself. Can someone help me?

I tried using sudo but it doesn't help. Here is my mount result for the partition:

/dev/sdb1 on /media/DATEN type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,fl‌​ush,uhelper=udisks)
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
mut3chs
  • 43
  • 1
  • 3
  • Who owns the file? Do you need to sudo before changing the permissions? – nopcorn Mar 03 '13 at 20:21
  • As pointed out below and above this comment, type 'mount' and post the results. – schaiba Mar 03 '13 at 21:17
  • Won't work for NTFS partiton – daisy Mar 04 '13 at 04:57
  • @MaxMackie I tried sudo but it doesn't help. Here my mount result for the partition: /dev/sdb1 on /media/DATEN type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks) – mut3chs Mar 09 '13 at 06:58

2 Answers2

7

This is a typical behaviour of a filesystem that doesn't understand access permissions - very likely a (V)FAT partition. This is also indicated by the path /media/..., which is where removable media is mounted nowadays.

The permission problem occurring when trying to run the script could be caused by the noexec mount option (which is understandable safeguard for removable media).

If the above is the case (you can verify that in the mount output), you can either run the script by specifying the interpreter, e.g. python /path/to/script, or remount the filesystem with the exec option (which generally is a silly workaround from the security point of view).

As a side note, the first option might not work if you your interpreter will try to use mmap() to load the file into memory and mark it as executable (because the filesystem layer will refuse that). This is usually the case of the dynamic linker ld-linux*.so* (located in lib or /lib64 depending on your system). Python should work though.

peterph
  • 30,838
  • thanks for your detailed answer, it's in fact a FAT32-Partition and since i can run programs by calling python it seems to be the problem you mentioned. – mut3chs Mar 04 '13 at 16:23
1

Is this non-unix partition? Try to mount the partition with permission option.

user33485
  • 11
  • 1