How to Change the Owner of a Drive Partition

The owner of a newly created drive partition is likely to be root which makes it hard for the user to create folders and copy files to it. This tutorial describes how to change it.

Assign the user to the owner of the drive partition

First we want to establish the path of the drive partition as seen by the operating system.

Use the lsblk command.

sdc      8:32   0 232.9G  0 disk 
├─sdc1   8:33   0   8.1G  0 part [SWAP]
├─sdc2   8:34   0  58.9G  0 part /
├─sdc3   8:35   0 146.3G  0 part /mnt/adata
└─sdc4   8:36   0  19.6G  0 part /mnt/dev

This gives us a tree view of the drives and their partitions.

To check the current owner:group use: ls -l <path>

Now we can use the chown command such as in the following example to change ownership to the logged-in user and see what changes were made.

sudo chown -vR $USER:$USER /mnt/adata

The -v option causes verbose output to tell you what was done and the R option causes subdirectories to be changed too, otherwise the target folder would not be changed if a subdirectory was owned by root.