Score:1

How to change permissions on external media

gh flag

After spending a lot of time going through previous answers to this question and finding everything either too old or for various reasons not applicable, or hitting problems when trying to follow step-by-step instructions, I'm now asking what appears to be a common question/problem:

How can I change the permissions for external media?

When I insert a USB drive, external hard drive, or SD card, I can view the files on it but not edit them unless I first copy them to my laptop's hard drive. frequently, particularly with photos, I want to leave the original on the external media & simply make a reduced copy to upload somewhere. so having to first copy the original, then edit it, then delete the copy is not terrible but it's annoying. it should be easy to change the permissions, right? on my previous Linux laptop this was never a problem, I could always edit files directly from the external media.

I have tried the chmod steps - this does nothing. I have tried creating a new directory within the media directory & telling the device to mount there, but I must be doing something wrong or the steps are not right for my device as it tells me the device doesn't exist.

I'm on Ubuntu 20.04.3 LTS with the Budgie desktop (am wondering if I should change back to Mate as that was what I had previously & it seemed more intuitive - but I don't think that will make a difference to the permissions problem).

Any help is much appreciated!

ChanganAuto avatar
us flag
It's not `chmod`, it's `chown`.
in flag
What file system is on these external devices? Are they using NTFS and ExFAT? Or are they using Linux-based file systems such as Ext4?
Score:1
cn flag

1 Prerequisite: make sure the file system is healthy

In order not to have problems with the file systems on removable drives, the file systems must be consistent, i.e., have been properly closed before.

Before trying anything else, have the file systems checked. Any issues you currently have may be related to an unclean file system.

  1. Open the utility "Disks" enter image description here
  2. In the left pane, click your external drive. A map showing the partition(s) on that drive will be shown on the right.
  3. Make sure the partition of interest is highlighted. Find the type of the file system next to the label "Contents" under the map. If this reads "ntfs", then quit Linux, connect the drive to a Windows file system and check it using the dedicated Windows tools. In all other cases, proceed.
  4. Unmount the file system by clicking on the leftmost icon under the map: it looks like a "Stop" icon: . This will cause the partition to be disconnected from the file system, i.e., unmounted.
  5. Now click the cog icon (second icon). Select "Check Filesystem...". Confirm the dialog. If the file system is healthy, a "Filesystem intact" dialog will appear. Else, the system will correct small issues or ask what to do.
  6. Click the first icon, which now looks as , to mount the drive again.

2 Default behaviour for healthy file systems

  • If the file system is supported by linux, but does not support file systems, the partition mount point will be owned by the current user. Thus, the user can read and write.for the current user. File systems include vfat, extfat and ntfs.
  • If the file system supports linux permissions, the partition will be mounted with owner root by default. Therefore, the administrator will first need to grant ownerships and permissions to either the entire partition, or possibly only to certain folders on that partition.

3 Changing ownership of a partition or a mount point

Once a partition containing a linux file system, granting ownership and permission works the same as for any other file and directory on the linux file system.

3.1 Using the graphical tool Disks

The same tool "Disks" allows to take ownership of the entire partition, and optionally also take ownership of all contents on that partition.

  1. Make sure the drive is mounted.
  2. Click once again the cog icon and select "Take Ownership". enter image description here Read the warning before you select the "Enable recursive mode" box.
  3. Hit OK. You will now be asked to enter your user password.

3.2 Using the terminal

Much more power and control is possible when changing the ownership through the terminal. You can change the ownership to any user of the system, you can change the ownership of the entire partition or only of selected directories on that partition, you can do it recursive or not...

  1. Determine the mount point of the drive, i.e., the directory from where the contents of the partition is accessible, from the output under the map of the partition in disks, next to the label "Contents". Where it says "Mounted at", take note of the listed directory path, e.g. /media/helen/Files.
  2. Execute the chown command to change owner and group of that mount point:

sudo chown helen:helen /media/helen/Files

sudo tells the system the next word is a command you want to execute with elevated priviledges. That command here is chown, the command to change ownership. Next, you specify <username>:<groupname>. On Ubuntu, you automatically have a group with the same name as your login. The last argument indicates what to change, i.e. a folder.

helen avatar
gh flag
thanks very much for the clear & detailed instructions. unfortunately i fell at the first step, as all 3 devices i'm trying are ntfs, and i do not have access to a windows system at the moment to do anything else with them. i will have to try over the weekend on someone else's computer. but what i don't understand is that on my previous linux computer i did not have this problem, the same external drives worked fine & i could edit directly on them. i will try to do this again but the old laptop is on the blink (screen & battery) so it's difficult to do much.
Score:-1
cn flag

With me this worked: I called from sudo terminal caja, and then changed the USB flash driver ownership from root to my username.

BeastOfCaerbannog avatar
ca flag
Can you be a bit more specific and [edit] your answer to provide the exact steps needed to solve the OP's problem? Thanks!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.