PureOS Security Quirks: How to change file permssions?

I copied files from a primary hard drive to inside a Luks image on a USB.

The file permissions were changed to read-only on the copy.

I need the folder & all the files to be unrestricted for all users.

I’ve tried to change the permissions through the UI. Not permitted.

sudo chown -R 777
sudo chmod -R u+rwx

Still no luck changing the permissions?

How would I change them in this case? (I want no restrictions for any users.)

You mixed change owner and change mode.
You want something like chmod o+rw, giving read and write permissions to others (a.k.a everybody)

By the way, how did you copy the files?
With cp? as root/sudo?
You might also want to try cp -a (preserving attributes)

2 Likes

I did a simple “copy to” operation using Nautilus Files.

I’ve tried the commands above, I just can’t change the permissions. They don’t change.

I think it has something to do with the files moved from the primary HD to an external storage device, because all the files copied to the external have this permissions issue.

Now, I need to change them all back across the board, and change whatever defaults are necessary so that files copied to the drive have unrestricted permissions.

Where/how would this be done?

It likely also has something to do with the Luks img is formated to FAT-32?

Seems it is read-only, and nothing I can do to change that?

Yes, FAT32 does not support file attributes.

2 Likes

Confirmed: FAT32 was the problem.

Solution? I need a file format I can share across Linux, Windows, OSX, on that USB… and will support read/write/delete file permissions? What would that be?

You should be able to write in FAT32 the permissions are determined in how is mounted.

I like to use NTFS over FAT32, but I’m not sure if MacOS support it.

1 Like

Like uzanto said, you can mount NTFS (I am not sure about FAT32 though) on Linux to allow file permissions to be set, but they will not be readable by Windows. So the short answer is, you can’t, those filesystems do not support file permission attributes on Windows (I stand corrected for my comment above), or to be more precise: the problem is in different file permission logic in Windows compared to a Linux OS.

1 Like

As your main problem seems to be that not every user can access the files, that is actually not a problem of FAT32 directly. As it doesn’t support permissions, no restrictions apply.

Rather, when mounting the partition, you can set global permissions that apply for the whole disk.

See this topic, especially the third answer discussing umask.

1 Like

I aways wondered the cause of that. It has happened to me before also.

However I always did my chmod correctly and never worried about it since it was so rare.

So if I use FAT32, it automounts when I plug it in. But it is read only it seems. Is there a way I can make it mount read/write automatically, without having to mount it using terminal command in that link:

mount -t vfat /dev/sda6 /media/FAT32 -o rw,uid=xxx,gid=xxx

I’m not familiar with the details of your setup, but a configuration line in /etc/fstab (similar to that command) might have the desired effect. Read up on fstab examples online.

Two notes:

  • to give access to all users, you need to add the umask. As I said, look at the third answer. You copied the command of the first.
  • do not use an identifier like /dev/sda6, as it is not guaranteed to be always the same for that disk. Rather, use the proper one in /dev/disk/by-id/
1 Like