Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If I try to set this option for a file on an external drive it just unmarks itself. Doing chmod +x has no effect. The drive is mounted with default options.

share|improve this question
4  
What is the filesystem on it? –  nickguletskii Jun 18 '11 at 12:08

3 Answers 3

up vote 26 down vote accepted

Your external disk is likely formatted NTFS or FAT32. Those filesystems do no support Linux file permissions.

You've now at least five options:

  • Just copy it to the desktop (or your Home folder) and set the permissions on that file.
  • Backup the data on it and reformat the drive to the ext4 filesystem. This can be done using the Disk Utility or GParted
  • Execute the file with a program, open a terminal and run:
    • for Bash scripts: bash /path/to/your/file.sh
    • for Python scripts: python /path/to/your/file.py
    • for Perl scripts: perl /path/to/your/file.pl
    • for windows executables: wine /path/to/your/file.exe
    • for 32-bit binaries: /lib/ld-linux.so.2 /path/to/your/file
    • for 64-bit binaries: /lib/ld-linux-x86-64.so.2 /path/to/your/file
  • Copy the file to your computer (e.g. home folder), set the execute bit on it and run it. (this cannot be done for all files)
  • (possibly dangerous) Mount the partition with the execute bit set for all files. To do so, follow these instructions:

    1. Mount the partition (by opening it in a file browser for example)
    2. Open a terminal and run:

      sudo mount -o remount,fmask=027 /media/YOURDRIVE
      

      If you cannot write / access files, run the command with ,uid=$(id -u) after fmask=022:

      sudo mount -o remount,fmask=027,id=$(id -u) /media/YOURDRIVE
      

    "Possibly dangerous" because you grant execute permissions to all files, only use this option if the other methods do not work.

share|improve this answer
7  
+1 for `/lib/ld-linux.so.2 file that is new for me –  enzotib Jun 18 '11 at 12:52
2  
wine /path/to/your/file also works for Windows applications. –  Capt.Nemo Jun 18 '11 at 13:00
    
@Capt.Nemo Good hint, added –  Lekensteyn Jun 18 '11 at 13:07
    
Nice answer; @Cap - Nice comment! –  boehj Jun 24 '11 at 18:11

If the filesystem is formatted as FAT or NTFS, you could always mount it with appropriate permissions. The default permissions when you mount from command line include execution permissions for all users.

To obtain more specific results, see the manual pages of mount.ntfs-3g and mount, the latter in the section Mount options for fat, in particular take a look at options uid, gid, umask, fmask, dmask,

share|improve this answer

Ubuntu 10.04 had no problem setting permissions to run programs or read/write on external drives.

It's an enduring trait for me that makes it the best version to ever run on a USB.
Whatever was taken away to stop this - and it's poor default wireless connectivity - is what makes 10.10 and beyond such a mess of frustration.

Fixing stuff like this should not be the job of the user. If mobile execution is a must, use 10.04.

share|improve this answer

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.