How to change permissions on external media
Solution 1:
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.
- Open the utility "Disks"
- In the left pane, click your external drive. A map showing the partition(s) on that drive will be shown on the right.
- 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.
- 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.
- 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.
- 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
andntfs
. - 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.
- Make sure the drive is mounted.
- Click once again the cog icon and select "Take Ownership". Read the warning before you select the "Enable recursive mode" box.
- 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...
- 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
. - 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 ch
ange own
ership. 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.