Ubuntu – Change owner of internal hard drive partition from root to user

hard drivepartitioningpermissionsrootusers

I have a number of drives internal and external. Some are partitioned. Most mount automatically at boot (all did at one point).

One partition is owned by root and therefore does not mount automatically. I know how to mount it as root.

I do not know how to take ownership of that partition as user X. I have tried changing permissions using the gui in Nautilus as root. They are not accepted and immediately revert.

The partition is NTFS. The other parition on that drive is owned by me as user and mounts automatically

Best Answer

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:

  1. Go to console (gnome-terminal)
  2. Type id -u. This should give you the user id you have which you will insert into fstab.
  3. Open fstab sudo /etc/fstab and search for the line that is mounting the ntfs partition.
  4. 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 with id -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.

Related Question