3

My old box running Ubuntu 9.04 passed away, so I plugged a flash drive into a newer box running Ubuntu 16.04.

But, I can't run scripts from there, because all files lost the x-permission. I can copy those files, but I can't chmod them, not even chmod a+w, not even using sudo.

chmod returns with no errors, echo $? shows 0.

It all worked perfectly on 9.04.

Here is what mount says:

/dev/sdd1 on /media/user/LABC type vfat   
 (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

I am aware of https://askubuntu.com/a/17550/778232 and I don't think it's a duplicate.

Firstly, with my problem here, not only +x is ignored. Secondly, the file where the answer proposes a change does not exist on my box.

Edit: What I don't understand, if FAT does not support Linux-like flags, why did it work with Ubuntu 9.04?

Edit 2:

Nope, this didn't work. I unmounted the device, created a new directory, mounted it with

mount /dev/sdd1 /media/LABC -o dmask=000,fmask=111

I can see the files, but still cannot chmod or chown (as root user). chown gives "Operation not permitted".

AJM
  • 205

2 Answers2

3

When working with external drives that are NOT formatted for Linux (FAT32, NTFS, etc.), you cannot use chmod to affect permissions on those drives.

chmod only supports UNIX-permissions-supported disk formats. If your disk is FAT32 or NTFS, these don't speak UNIX permissions and therefore do not work with chmod.

You need to change the mount options on your disk to mount it so everything has the execute bit.

Execute this as your user: sudo mount -t vfat -o remount,umask=0002,defaults,auto,uid=$(id -u),gid=$(id -g) /dev/sdd1 /media/LABC

This will give +x to all files.

Thomas Ward
  • 78,878
1

In my honest experience, If you have a dual boot computer then you're lucky and you can try "Repair this drive" in Windows. This usually fixes my problems.