Change owner of internal hard drive partition from root to user
Did you try
sudo chown user:user
For example sudo chown cyrex:cyrex
(User:Group)
if the partition is called party, your user is called cyrex and it is in /media
just do for example:
sudo chown cyrex:cyrex /media/cyrex/party -R
(The R is for recursive so it affects all directory/files and subdirectory.
As noted, the partition is NTFS so if is automatically mounted you need to make sure that the user that has permission is you. To do this follow this steps:
- Go to console (
gnome-terminal
) - Type
id -u
. This should give you the user id you have which you will insert into fstab. - Open fstab
sudo /etc/fstab
and search for the line that is mounting the ntfs partition. Assuming is something like this:
UUID=1234532123 /media/amntfs ntfs defaults 0 0
Add to it the umask, uid and gid masks like this
UUID=1234532123 /media/amntfs ntfs defaults,umask=007,uid=1000,gid=1000 0 0
Save the file and just reboot or remount the unit.
Here:
- The uid is your User ID. The one you got from
id -u
. - The gid is you Group ID. Normally the same as
id -u
but you can check it withid -g
. - The umask is like chown but reversed.
See How do I use 'chmod' on an NTFS (or FAT32) partition? on more about using chmod
/chown
on NTFS filesystems.
All my NTFS partitions are owned by root, yet I can access them fine as user. It's a matter of mount options rather than ownership and file permissions (remember, it's a NTFS partition - you can't change any permissions there).
In my /etc/fstab
the partitions are included as follows:
UUID=AB84274F84211B98 /media/WIN7 ntfs defaults 0 0
UUID=CDBAF39E13A2AC2D /media/DATA ntfs defaults 0 0
UUID=EFA980B33BA33DF5 /media/MEDIA ntfs defaults 0 0
where defaults
are default mount options that already should do what you want to do.
To find the UUIDs, run sudo blkid
.
See also: How do I use 'chmod' on an NTFS (or FAT32) partition?