Chmod won’t work – no error message

chmod

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)

Best Answer

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.

Related Question