Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Everytime 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 doesnt work. I tried octal and =rwx spelling but the output of ls -l wont change and i still get errors like: no Permission if I try to execute a file. The curios thing is, that i dont get any error message of chmod itself. Can someone help me ? Thanks

share|improve this question
    
Who owns the file? Do you need to sudo before changing the permissions? –  MaxMackie Mar 3 '13 at 20:21
    
As pointed out below and above this comment, type 'mount' and post the results. –  schaiba Mar 3 '13 at 21:17
    
Won't work for NTFS partiton –  warl0ck Mar 4 '13 at 4: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,fl‌​ush,uhelper=udisks) –  mut3chs Mar 9 '13 at 6:58
add comment

2 Answers 2

up vote 7 down vote accepted

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.

share|improve this answer
    
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 4 '13 at 16:23
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.